{"id":63,"date":"2026-08-25T13:37:40","date_gmt":"2026-08-25T13:37:40","guid":{"rendered":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/?page_id=63"},"modified":"2026-08-25T13:48:32","modified_gmt":"2026-08-25T13:48:32","slug":"gen-ai","status":"publish","type":"page","link":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/?page_id=63","title":{"rendered":"GEN AI"},"content":{"rendered":"\n<h2><br><strong>Few easy steps for integration of AI-Chat-Model to a Spring-Boot Web application using Spring AI.<\/strong><\/h2>\n\n\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a Spring-Boot web-application.<\/li>\n\n\n\n<li>create REST-Api in web-application to communicate with an AI model.\u00a0<\/li>\n\n\n\n<li>Angular\/React frontend that provides the user interface to web-application.\u00a0<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Pre-requisite &#8211;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>JDK 11+\u00a0<\/li>\n\n\n\n<li>Maven\/Gradle.<\/li>\n\n\n\n<li>Spring Boot Setup<\/li>\n\n\n\n<li>Basic Understanding of AI\/ML Concepts<\/li>\n\n\n\n<li>AI-CHAT-Model API_key and details of AI-Model provider such as OpenAI or Gemini.<\/li>\n\n\n\n<li>Knowledge of Frontend framework, such as Angular or React.<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Steps &#8211;&nbsp;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a Spring Boot project using\u00a0http:\/\/start.spring.io (Spring-Initilizer).<\/li>\n\n\n\n<li>Select and add Spring Web and Spring AI dependencies ex \u2013\u00a0<\/li>\n\n\n\n<li><strong>spring-boot-starter-web<\/strong>\u00a0 SpringBoot Starter Web for RESTful services<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>spring-boot-starter-ai<\/strong> \/ <strong>spring-ai-openai-spring-boot-starter<\/strong>\u00a0 Spring AI Starter for integrating AI models<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li><strong>jackson-databind<\/strong>\u00a0 Jackson for JSON processing<\/li>\n<\/ul>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Configure the\u00a0spring-config file as application.yml or application.properties\u00a0 with the API-key.<\/li>\n\n\n\n<li>Create ChatClient Bean or custom classes or interface of ChatClient of Spring-AI.<\/li>\n\n\n\n<li>Create a service class using above ChatClient implementation to interact with AI-Model.\n<ul class=\"wp-block-list\">\n<li>Add following http-request Headers \u2013\n<ul class=\"wp-block-list\">\n<li><strong>ContentType<\/strong> = MediaType.APPLICATION_JSON<\/li>\n\n\n\n<li><strong>Authorization<\/strong> = \u201cBearer AI_Model_API_Key\u201d<\/li>\n<\/ul>\n<\/li>\n\n\n\n<li>Spring-AI API_Call Request-Parameters \u2013\n<ul class=\"wp-block-list\">\n<li><strong>Model<\/strong> = gpt-3.5-turbo. (AI Model Name)<\/li>\n\n\n\n<li><strong>Temperature<\/strong> = 1 (Fine-Tuning-Param)<\/li>\n\n\n\n<li><strong>max_tokens<\/strong> = 110 (Fine-Tuning-Param)<\/li>\n\n\n\n<li><strong>messages<\/strong> in following json-schema-format \u2013<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">&nbsp;[ {\u201crole\u201d: \u201duser\u201d, \u201ccontent\u201d: <strong>\u201d&lt;User-Input-Prompt&gt;<\/strong>\u201d}&nbsp; ] &nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">(Rest Api Call Request_Body Schema)<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Create a\u00a0RestController\u00a0to expose the\u00a0ChatClient functionality as API. Ex &#8211; \u201c<strong>\/api\/ai\/chatbot<\/strong>\u201d.<\/li>\n\n\n\n<li>Create a SPA-GUI to invoke RestController using Angular or React etc.<\/li>\n\n\n\n<li>Configure CORS to enable communication between the frontend and backend (RestAPI).<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>Chat_Model interaction steps \u2013&nbsp;<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Run Spring Boot Application<\/li>\n\n\n\n<li>Open GUI Page.<\/li>\n\n\n\n<li>Enter user-prompt as user-input.<\/li>\n\n\n\n<li>Get Response from AI_Model-Prpvider.\u00a0<\/li>\n<\/ul>\n\n\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":32,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"pagelayer_contact_templates":[],"_pagelayer_content":"","footnotes":""},"class_list":["post-63","page","type-page","status-publish","has-post-thumbnail","hentry"],"_links":{"self":[{"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=\/wp\/v2\/pages\/63","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=63"}],"version-history":[{"count":1,"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=\/wp\/v2\/pages\/63\/revisions"}],"predecessor-version":[{"id":64,"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=\/wp\/v2\/pages\/63\/revisions\/64"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=\/wp\/v2\/media\/32"}],"wp:attachment":[{"href":"https:\/\/createwithnaturalwisdom.com\/ajavadeveloperdetails\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=63"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}