<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Shubham Bhati</title>
    <description>The latest articles on Forem by Shubham Bhati (@shubham_bhati).</description>
    <link>https://forem.com/shubham_bhati</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F3935276%2Fa996911a-6c8f-4d5e-ab58-f46b8c58c670.png</url>
      <title>Forem: Shubham Bhati</title>
      <link>https://forem.com/shubham_bhati</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/shubham_bhati"/>
    <language>en</language>
    <item>
      <title>Calling OpenAI from Spring Boot: A Production-Ready Integration</title>
      <dc:creator>Shubham Bhati</dc:creator>
      <pubDate>Mon, 18 May 2026 07:09:47 +0000</pubDate>
      <link>https://forem.com/shubham_bhati/calling-openai-from-spring-boot-a-production-ready-integration-13c4</link>
      <guid>https://forem.com/shubham_bhati/calling-openai-from-spring-boot-a-production-ready-integration-13c4</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsource.unsplash.com%2F1200x630%2F%3Fai%2Copenai%2Capi%26sig%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsource.unsplash.com%2F1200x630%2F%3Fai%2Copenai%2Capi%26sig%3D1" alt="Spring Boot Openai Integration" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Published 2026-05-18 by &lt;a href="https://shubh2-0.github.io" rel="noopener noreferrer"&gt;Shubham Bhati&lt;/a&gt; — Backend Engineer (Java 17, Spring Boot, Microservices).&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We've all been there - trying to integrate a third-party API into our Spring Boot application, only to hit a roadblock. Recently, we encountered this issue while trying to integrate OpenAI into our Java backend using Spring Boot. The primary goal was to create a seamless Spring Boot OpenAI integration, enabling our application to tap into the power of AI. After overcoming several hurdles, we successfully implemented the integration, and our application is now capable of utilizing OpenAI's features.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduction to OpenAI API&lt;/li&gt;
&lt;li&gt;Setting up OpenAI with Spring Boot&lt;/li&gt;
&lt;li&gt;Creating a Service to Handle OpenAI Requests&lt;/li&gt;
&lt;li&gt;Error Handling and Logging&lt;/li&gt;
&lt;li&gt;Performance Optimization&lt;/li&gt;
&lt;li&gt;Common Mistakes&lt;/li&gt;
&lt;li&gt;FAQ&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction to OpenAI API
&lt;/h2&gt;

&lt;p&gt;The OpenAI API provides a wide range of features, including text completion, language translation, and text classification. To use the OpenAI API, you need to create an account on their website and obtain an API key. We're using Java 21 and Spring Boot 3.2 for our application, which provides a solid foundation for building a production-ready integration. The OpenAI API uses a RESTful architecture, making it easy to integrate with our Spring Boot application. We can use the &lt;a href="https://docs.spring.io/spring-boot/docs/3.2.0/reference/htmlsingle/#web" rel="noopener noreferrer"&gt;Spring Web&lt;/a&gt; module to make HTTP requests to the OpenAI API.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Import necessary dependencies&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.beans.factory.annotation.Value&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.http.HttpEntity&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.http.HttpHeaders&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.http.HttpMethod&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.http.ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
&lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="nn"&gt;org.springframework.web.client.RestTemplate&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Create a RestTemplate instance&lt;/span&gt;
&lt;span class="nc"&gt;RestTemplate&lt;/span&gt; &lt;span class="n"&gt;restTemplate&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;RestTemplate&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

&lt;span class="c1"&gt;// Set API key and base URL&lt;/span&gt;
&lt;span class="nd"&gt;@Value&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"${openai.api.key}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="nd"&gt;@Value&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"${openai.base.url}"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;baseUrl&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

&lt;span class="c1"&gt;// Create a method to make requests to the OpenAI API&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;makeRequest&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Set headers and entity&lt;/span&gt;
    &lt;span class="nc"&gt;HttpHeaders&lt;/span&gt; &lt;span class="n"&gt;headers&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HttpHeaders&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;set&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Authorization"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="s"&gt;"Bearer "&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="n"&gt;apiKey&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="nc"&gt;HttpEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HttpEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;headers&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Make the request&lt;/span&gt;
    &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;restTemplate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;exchange&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;baseUrl&lt;/span&gt; &lt;span class="o"&gt;+&lt;/span&gt; &lt;span class="s"&gt;"/completions"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;HttpMethod&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;POST&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;entity&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

    &lt;span class="c1"&gt;// Return the response&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getBody&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Setting up OpenAI with Spring Boot
&lt;/h2&gt;

&lt;p&gt;To set up OpenAI with Spring Boot, you need to add the necessary dependencies to your &lt;code&gt;pom.xml&lt;/code&gt; file (if you're using Maven) or your &lt;code&gt;build.gradle&lt;/code&gt; file (if you're using Gradle). We're using the &lt;a href="https://docs.spring.io/spring-boot/docs/3.2.0/reference/htmlsingle/#boot-features-developing-web-applications" rel="noopener noreferrer"&gt;Spring Boot Starter Web&lt;/a&gt; module, which provides a convenient way to build web applications. You also need to configure the OpenAI API key and base URL in your application properties file.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight properties"&gt;&lt;code&gt;&lt;span class="c"&gt;# application.properties
&lt;/span&gt;&lt;span class="py"&gt;openai.api.key&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;YOUR_API_KEY&lt;/span&gt;
&lt;span class="py"&gt;openai.base.url&lt;/span&gt;&lt;span class="p"&gt;=&lt;/span&gt;&lt;span class="s"&gt;https://api.openai.com/v1&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Creating a Service to Handle OpenAI Requests
&lt;/h2&gt;

&lt;p&gt;To handle OpenAI requests, we created a service that encapsulates the logic for making requests to the OpenAI API. This service uses the &lt;code&gt;RestTemplate&lt;/code&gt; instance to make HTTP requests to the OpenAI API. We're using the &lt;a href="https://docs.spring.io/spring-framework/docs/5.3.23/reference/html/core.html#beans" rel="noopener noreferrer"&gt;Spring Framework's dependency injection&lt;/a&gt; feature to inject the &lt;code&gt;RestTemplate&lt;/code&gt; instance into our service.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// OpenAI Service&lt;/span&gt;
&lt;span class="nd"&gt;@Service&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;OpenAIService&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;@Autowired&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="nc"&gt;RestTemplate&lt;/span&gt; &lt;span class="n"&gt;restTemplate&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="nf"&gt;makeRequest&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="c1"&gt;// Make the request using the RestTemplate instance&lt;/span&gt;
        &lt;span class="nc"&gt;ResponseEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;restTemplate&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;exchange&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"https://api.openai.com/v1/completions"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;HttpMethod&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;POST&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nc"&gt;HttpEntity&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&amp;gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;),&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;

        &lt;span class="c1"&gt;// Return the response&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getBody&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Error Handling and Logging
&lt;/h2&gt;

&lt;p&gt;Error handling and logging are crucial aspects of building a production-ready integration. We're using the &lt;a href="https://docs.spring.io/spring-framework/docs/5.3.23/reference/html/core.html#core-exception" rel="noopener noreferrer"&gt;Spring Framework's exception handling&lt;/a&gt; feature to handle exceptions that occur during the execution of our application. We're also using the &lt;a href="https://logback.qos.ch/" rel="noopener noreferrer"&gt;Logback&lt;/a&gt; logging framework to log important events in our application.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Error handling example&lt;/span&gt;
&lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Make the request&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;response&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;openAIService&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;makeRequest&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Log the exception&lt;/span&gt;
    &lt;span class="nc"&gt;Logger&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getLogger&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;OpenAIService&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;class&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getName&lt;/span&gt;&lt;span class="o"&gt;()).&lt;/span&gt;&lt;span class="na"&gt;log&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Level&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;SEVERE&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Performance Optimization
&lt;/h2&gt;

&lt;p&gt;Performance optimization is critical to ensuring that our application can handle a large volume of requests. We're using the &lt;a href="https://docs.oracle.com/javase/tutorial/essential/concurrency/" rel="noopener noreferrer"&gt;Java 21's built-in support for concurrent programming&lt;/a&gt; to optimize the performance of our application. We're also using the &lt;a href="https://docs.spring.io/spring-boot/docs/3.2.0/reference/htmlsingle/#boot-features-caching" rel="noopener noreferrer"&gt;Spring Boot's support for caching&lt;/a&gt; to cache frequently accessed data.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="c1"&gt;// Performance optimization example&lt;/span&gt;
&lt;span class="c1"&gt;// Use Java 21's concurrent programming features to optimize performance&lt;/span&gt;
&lt;span class="nc"&gt;ExecutorService&lt;/span&gt; &lt;span class="n"&gt;executor&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nc"&gt;Executors&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;newFixedThreadPool&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;10&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="nc"&gt;Future&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;String&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;future&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;executor&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;submit&lt;/span&gt;&lt;span class="o"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;openAIService&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;makeRequest&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;prompt&lt;/span&gt;&lt;span class="o"&gt;));&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Common Mistakes
&lt;/h2&gt;

&lt;p&gt;Here are some common mistakes to avoid when integrating OpenAI with Spring Boot:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not handling exceptions properly&lt;/li&gt;
&lt;li&gt;Not logging important events&lt;/li&gt;
&lt;li&gt;Not optimizing performance&lt;/li&gt;
&lt;li&gt;Not configuring the OpenAI API key and base URL correctly&lt;/li&gt;
&lt;li&gt;Not using the correct dependencies in your &lt;code&gt;pom.xml&lt;/code&gt; or &lt;code&gt;build.gradle&lt;/code&gt; file&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is the OpenAI API?
&lt;/h3&gt;

&lt;p&gt;The OpenAI API provides a wide range of features, including text completion, language translation, and text classification. You can use the OpenAI API to build applications that utilize the power of AI.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I integrate OpenAI with Spring Boot?
&lt;/h3&gt;

&lt;p&gt;To integrate OpenAI with Spring Boot, you need to add the necessary dependencies to your &lt;code&gt;pom.xml&lt;/code&gt; file (if you're using Maven) or your &lt;code&gt;build.gradle&lt;/code&gt; file (if you're using Gradle). You also need to configure the OpenAI API key and base URL in your application properties file.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the difference between Spring AI and OpenAI?
&lt;/h3&gt;

&lt;p&gt;Spring AI is a framework for building AI-powered applications, while OpenAI is a platform that provides a wide range of AI features, including text completion, language translation, and text classification.&lt;/p&gt;

&lt;h3&gt;
  
  
  Can I use OpenAI with Java?
&lt;/h3&gt;

&lt;p&gt;Yes, you can use OpenAI with Java. OpenAI provides a RESTful API that can be accessed using Java's built-in support for HTTP requests. You can use the &lt;a href="https://docs.spring.io/spring-boot/docs/3.2.0/reference/htmlsingle/#web" rel="noopener noreferrer"&gt;Spring Web&lt;/a&gt; module to make HTTP requests to the OpenAI API.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In this article, we've discussed how to integrate OpenAI with Spring Boot. We've covered the basics of the OpenAI API, how to set up OpenAI with Spring Boot, and how to create a service to handle OpenAI requests. We've also discussed error handling and logging, performance optimization, and common mistakes to avoid. To learn more about Spring Boot and OpenAI, you can visit the &lt;a href="https://docs.spring.io/spring-boot/docs/3.2.0/reference/htmlsingle/" rel="noopener noreferrer"&gt;Spring Boot documentation&lt;/a&gt; and the &lt;a href="https://beta.openai.com/docs/" rel="noopener noreferrer"&gt;OpenAI documentation&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsource.unsplash.com%2F1000x500%2F%3Fai%2Copenai%2Capi%26sig%3D2" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsource.unsplash.com%2F1000x500%2F%3Fai%2Copenai%2Capi%26sig%3D2" alt="Spring Boot Openai Integration in production" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/" rel="noopener noreferrer"&gt;Spring Boot Official Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.baeldung.com/" rel="noopener noreferrer"&gt;Baeldung — Java &amp;amp; Spring Tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.oracle.com/en/java/" rel="noopener noreferrer"&gt;Oracle Java Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Shubham Bhati&lt;/em&gt;* — Backend Engineer at AlignBits LLC, specializing in Java 17, Spring Boot, microservices, and AI integration. Connect on &lt;a href="https://linkedin.com/in/bhatishubham" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://github.com/Shubh2-0" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, or read more at &lt;a href="https://shubh2-0.github.io" rel="noopener noreferrer"&gt;shubh2-0.github.io&lt;/a&gt;.*&lt;/p&gt;

</description>
      <category>openai</category>
      <category>ai</category>
      <category>springboot</category>
      <category>java</category>
    </item>
    <item>
      <title>15 Production Incidents in a Healthcare Backend: FHIR Lessons</title>
      <dc:creator>Shubham Bhati</dc:creator>
      <pubDate>Mon, 18 May 2026 07:08:58 +0000</pubDate>
      <link>https://forem.com/shubham_bhati/15-production-incidents-in-a-healthcare-backend-fhir-lessons-3p7b</link>
      <guid>https://forem.com/shubham_bhati/15-production-incidents-in-a-healthcare-backend-fhir-lessons-3p7b</guid>
      <description>&lt;h1&gt;
  
  
  15 Production Incidents in a Healthcare Backend: What FHIR Taught Me About Reliability
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;By Shubham Bhati — Backend Engineer at AlignBits LLC&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;When I joined IHX Private Limited in June 2023 as an Associate Software Engineer, I had Masai's certificate and a few personal Java projects. By the time I left in August 2024, I'd resolved 15+ production incidents on FHIR-standard healthcare backend systems.&lt;/p&gt;

&lt;p&gt;That number sounds bad. It isn't. Production engineering is where you actually learn to build software. Here's what FHIR healthcare backends taught me — beyond what any Spring Boot tutorial covers.&lt;/p&gt;




&lt;h2&gt;
  
  
  What FHIR is (in 60 seconds)
&lt;/h2&gt;

&lt;p&gt;FHIR — &lt;strong&gt;Fast Healthcare Interoperability Resources&lt;/strong&gt; — is a standard for exchanging healthcare data. Think of it as REST + JSON for hospitals, labs, insurers, and EHR systems.&lt;/p&gt;

&lt;p&gt;Every domain object is a "Resource": &lt;code&gt;Patient&lt;/code&gt;, &lt;code&gt;Practitioner&lt;/code&gt;, &lt;code&gt;Encounter&lt;/code&gt;, &lt;code&gt;Observation&lt;/code&gt;, &lt;code&gt;Coverage&lt;/code&gt;, &lt;code&gt;Claim&lt;/code&gt;. Each has a well-defined JSON schema with strict validation rules.&lt;/p&gt;

&lt;p&gt;In Java, the standard library is &lt;a href="https://hapifhir.io/" rel="noopener noreferrer"&gt;HAPI FHIR&lt;/a&gt;. It's huge, opinionated, and 95% of what you need.&lt;/p&gt;




&lt;h2&gt;
  
  
  What "production" means in healthcare
&lt;/h2&gt;

&lt;p&gt;In a typical SaaS, an outage costs revenue. In healthcare:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A patient might not get their meds approved.&lt;/li&gt;
&lt;li&gt;A claim might be misrouted.&lt;/li&gt;
&lt;li&gt;A practitioner might see wrong data.&lt;/li&gt;
&lt;li&gt;Regulators audit your logs.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;This isn't fear-mongering. It's why FHIR healthcare backends force you to learn engineering disciplines that consumer apps let you skip.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lesson 1: Schema validation is not optional
&lt;/h2&gt;

&lt;p&gt;Patient records flow in from ~20 different EHR vendors. Each interprets FHIR slightly differently. Some send dates as &lt;code&gt;YYYY-MM-DD&lt;/code&gt;, others as full timestamps, some omit required fields, some send extension data your parser doesn't recognize.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;What we learned:&lt;/strong&gt; validate at the boundary, log the failures, never crash the pipeline.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@Component&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;FhirValidator&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;private&lt;/span&gt; &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="nc"&gt;FhirValidator&lt;/span&gt; &lt;span class="n"&gt;validator&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;

    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;ValidationResult&lt;/span&gt; &lt;span class="nf"&gt;validate&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;IBaseResource&lt;/span&gt; &lt;span class="n"&gt;resource&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;ValidationResult&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;validator&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;validateWithResult&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;resource&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="o"&gt;(!&lt;/span&gt;&lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;isSuccessful&lt;/span&gt;&lt;span class="o"&gt;())&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
            &lt;span class="n"&gt;log&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;warn&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"fhir.validation.failed resource={} errors={}"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
                &lt;span class="n"&gt;resource&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;fhirType&lt;/span&gt;&lt;span class="o"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getMessages&lt;/span&gt;&lt;span class="o"&gt;());&lt;/span&gt;
            &lt;span class="c1"&gt;// do NOT throw — route to dead-letter for human review&lt;/span&gt;
        &lt;span class="o"&gt;}&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;result&lt;/span&gt;&lt;span class="o"&gt;;&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Bad validation handling caused 4 of our 15 incidents. Fixed it once, gone forever.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lesson 2: Idempotency or death
&lt;/h2&gt;

&lt;p&gt;Healthcare integrations retry. A lot. Network blips, gateway timeouts, scheduler restarts — every one triggers a retry. If your handler isn't idempotent, you create duplicate &lt;code&gt;Observation&lt;/code&gt; records for one blood test. Patients now appear to have run a CBC twice.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix:&lt;/strong&gt; every inbound FHIR message has a deterministic ID. Use it.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;Observation&lt;/span&gt; &lt;span class="nf"&gt;upsert&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Observation&lt;/span&gt; &lt;span class="n"&gt;obs&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;idempotencyKey&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;obs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;getIdentifierFirstRep&lt;/span&gt;&lt;span class="o"&gt;().&lt;/span&gt;&lt;span class="na"&gt;getValue&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;observationRepo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findByIdempotencyKey&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;idempotencyKey&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
        &lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;orElseGet&lt;/span&gt;&lt;span class="o"&gt;(()&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;observationRepo&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;save&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;obs&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;withKey&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;idempotencyKey&lt;/span&gt;&lt;span class="o"&gt;)));&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;We turned every write into an upsert keyed on a stable business key. Duplicate-record bugs dropped to zero.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lesson 3: The clock is not your friend
&lt;/h2&gt;

&lt;p&gt;Different sources stamp their FHIR resources with different time zones. UTC, IST, sometimes naïve local time with no zone. Sometimes the clock is wrong.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Rules I now follow:&lt;/strong&gt;&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Parse everything to &lt;code&gt;Instant&lt;/code&gt; at ingress — never &lt;code&gt;LocalDateTime&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;Store as UTC in the database.&lt;/li&gt;
&lt;li&gt;Format to user's locale only at the edge (controller / response mapper).&lt;/li&gt;
&lt;li&gt;If a timestamp has no zone, treat it as suspect and log it.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Caused 3 of our incidents. Twice the bug was "patient timeline shows future appointment" because someone stored IST as UTC.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lesson 4: Don't trust the network — design for partial failure
&lt;/h2&gt;

&lt;p&gt;FHIR integrations are a graph of remote calls: ingress webhook → validation → transform → enrichment from EHR → push to insurer. Anywhere in the chain can fail.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Patterns that work:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Every step is independently retryable&lt;/li&gt;
&lt;li&gt;Every step writes to a durable store (DB or queue) before moving on&lt;/li&gt;
&lt;li&gt;A failed step doesn't block other patients' messages&lt;/li&gt;
&lt;li&gt;A circuit breaker protects you from a slow downstream&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We standardized on this pattern after an incident where one slow insurer API caused a thread pool to fill and blocked all unrelated patient traffic. Resilience4j circuit breaker fixed it permanently.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lesson 5: Logging structure matters more than log volume
&lt;/h2&gt;

&lt;p&gt;When you're paged at 2am, you don't want to grep 10GB of unstructured logs. You want one query.&lt;/p&gt;

&lt;p&gt;We moved every log line to structured JSON with these fields:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;correlation_id&lt;/code&gt; — uniquely identifies a patient message across all services&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;tenant_id&lt;/code&gt; — which hospital/clinic&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;resource_type&lt;/code&gt; — Patient, Observation, etc.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;event&lt;/code&gt; — what just happened&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;duration_ms&lt;/code&gt; — how long it took&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;outcome&lt;/code&gt; — success / failure / partial&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;One query against our log store told us which tenant, which resource, which step, what went wrong. MTTR (mean time to recovery) for incidents dropped from ~40 minutes to ~8.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lesson 6: PII logging will get you in trouble
&lt;/h2&gt;

&lt;p&gt;You will not log patient names. You will not log SSNs / Aadhaar numbers. You will not log diagnoses. Period.&lt;/p&gt;

&lt;p&gt;What you can log:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resource type, resource ID hash, tenant ID&lt;/li&gt;
&lt;li&gt;Timestamps, durations, outcomes&lt;/li&gt;
&lt;li&gt;Sanitized field-presence (e.g., "had_address=true", not the address)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We added a pre-commit hook that scanned every PR for "obvious PII leak" patterns. Caught 2 leaks before they shipped.&lt;/p&gt;




&lt;h2&gt;
  
  
  Lesson 7: The on-call rotation is the best teacher
&lt;/h2&gt;

&lt;p&gt;Six months into my role, my manager added me to on-call rotation. I was nervous. It was the single best decision for my engineering growth.&lt;/p&gt;

&lt;p&gt;You learn things on-call you cannot learn anywhere else:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;What your system actually does at 3am&lt;/li&gt;
&lt;li&gt;Which logs are useful and which are noise&lt;/li&gt;
&lt;li&gt;Which alerts are signal and which are noise&lt;/li&gt;
&lt;li&gt;How a small bug in deployment becomes a customer-impacting incident in 12 minutes&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If your role lets you opt into on-call, do it. It's the fastest engineering compounding you can get.&lt;/p&gt;




&lt;h2&gt;
  
  
  The compounding effect
&lt;/h2&gt;

&lt;p&gt;After 15 months at IHX, I wasn't just "the Spring Boot guy from Masai." I was someone who'd debugged production at 2am, understood SLOs, had a feel for trade-offs between consistency and availability. That changed everything about how I approached engineering interviews afterwards.&lt;/p&gt;

&lt;p&gt;It's also why I now work on integration platforms at AlignBits — the patterns are the same. Different domain, same engineering rules.&lt;/p&gt;




&lt;h2&gt;
  
  
  If you're starting in healthcare backend
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Read the HAPI FHIR docs&lt;/strong&gt;. The 80% you need fits in a weekend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get familiar with one EHR's API&lt;/strong&gt; (Epic FHIR sandbox is free).&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Pick a real test fixture set&lt;/strong&gt;. Synthea generates realistic FHIR data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get on a real on-call rotation as soon as you can&lt;/strong&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find a senior engineer who'll review your code line-by-line&lt;/strong&gt;. Mine made me 3x as good in 6 months.&lt;/li&gt;
&lt;/ol&gt;




&lt;p&gt;&lt;em&gt;Shubham Bhati is a Backend Engineer at AlignBits LLC. Previously Associate Software Engineer at IHX Private Limited working on FHIR-standard healthcare backend systems. Based in Gurgaon, India. &lt;a href="https://shubh2-0.github.io" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt; · &lt;a href="https://github.com/Shubh2-0" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://linkedin.com/in/bhatishubham" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Publishing checklist:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Cover image: abstract flow diagram or HL7 FHIR logo&lt;/li&gt;
&lt;li&gt;[ ] Tags: &lt;code&gt;#java&lt;/code&gt; &lt;code&gt;#springboot&lt;/code&gt; &lt;code&gt;#healthcare&lt;/code&gt; &lt;code&gt;#fhir&lt;/code&gt; &lt;code&gt;#hapifhir&lt;/code&gt; &lt;code&gt;#backend&lt;/code&gt; &lt;code&gt;#productionengineering&lt;/code&gt; &lt;code&gt;#microservices&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;[ ] Add a "FHIR resources" link section at the bottom for SEO&lt;/li&gt;
&lt;li&gt;[ ] Cross-post to Dev.to and Hashnode after 24h&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>healthcare</category>
      <category>productivity</category>
      <category>backend</category>
    </item>
    <item>
      <title>Spring Boot REST API Best Practices in 2026: A Production Guide</title>
      <dc:creator>Shubham Bhati</dc:creator>
      <pubDate>Sat, 16 May 2026 20:36:08 +0000</pubDate>
      <link>https://forem.com/shubham_bhati/spring-boot-rest-api-best-practices-in-2026-a-production-guide-267f</link>
      <guid>https://forem.com/shubham_bhati/spring-boot-rest-api-best-practices-in-2026-a-production-guide-267f</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsource.unsplash.com%2F1200x630%2F%3Fjava%2Cprogramming%2Ccode%26sig%3D1" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsource.unsplash.com%2F1200x630%2F%3Fjava%2Cprogramming%2Ccode%26sig%3D1" alt="Spring Boot Rest Api Best Practices" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;Published 2026-05-17 by &lt;a href="https://shubh2-0.github.io" rel="noopener noreferrer"&gt;Shubham Bhati&lt;/a&gt; — Backend Engineer (Java 17, Spring Boot, Microservices).&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We've all been there - stuck with a slow and unresponsive Spring Boot REST API in production, wondering where it all went wrong. Recently, we encountered a similar issue with one of our APIs, where the average response time was over 500ms. After digging into the code, we realized that we weren't following some of the essential Spring Boot REST API best practices. In this article, we'll share our experience and provide a comprehensive guide on how to build production-grade REST APIs using Spring Boot.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Introduction to REST API Design&lt;/li&gt;
&lt;li&gt;Choosing the Right HTTP Methods&lt;/li&gt;
&lt;li&gt;Error Handling and Logging&lt;/li&gt;
&lt;li&gt;Database Schema Design&lt;/li&gt;
&lt;li&gt;Common Mistakes&lt;/li&gt;
&lt;li&gt;Security Considerations&lt;/li&gt;
&lt;li&gt;FAQ&lt;/li&gt;
&lt;li&gt;Conclusion&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Introduction to REST API Design
&lt;/h2&gt;

&lt;p&gt;When designing a REST API, it's essential to keep in mind the principles of RESTful architecture. This includes using HTTP methods (GET, POST, PUT, DELETE) to interact with resources, using meaningful resource names, and handling errors properly. We've found that using a tool like &lt;a href="https://www.postman.com/" rel="noopener noreferrer"&gt;Postman&lt;/a&gt; can be incredibly helpful in testing and debugging our APIs. For example, let's consider a simple API that returns a list of users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@RestController&lt;/span&gt;
&lt;span class="nd"&gt;@RequestMapping&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"/users"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;UserController&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="nd"&gt;@GetMapping&lt;/span&gt;
    &lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;getUsers&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findAll&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we're using the &lt;code&gt;@GetMapping&lt;/code&gt; annotation to map the &lt;code&gt;/users&lt;/code&gt; endpoint to the &lt;code&gt;getUsers()&lt;/code&gt; method, which returns a list of users.&lt;/p&gt;

&lt;h2&gt;
  
  
  Choosing the Right HTTP Methods
&lt;/h2&gt;

&lt;p&gt;Choosing the right HTTP method for your API endpoint is crucial. For instance, if you're creating a new resource, you should use the POST method. If you're updating an existing resource, you should use the PUT method. We've seen cases where using the wrong HTTP method can lead to unexpected behavior and errors. For example, let's consider an API that creates a new user:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@PostMapping&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="nf"&gt;createUser&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@RequestBody&lt;/span&gt; &lt;span class="nc"&gt;User&lt;/span&gt; &lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;save&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;user&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we're using the &lt;code&gt;@PostMapping&lt;/code&gt; annotation to map the &lt;code&gt;/users&lt;/code&gt; endpoint to the &lt;code&gt;createUser()&lt;/code&gt; method, which creates a new user.&lt;/p&gt;

&lt;h2&gt;
  
  
  Error Handling and Logging
&lt;/h2&gt;

&lt;p&gt;Error handling and logging are critical components of a production-grade REST API. We've found that using a combination of try-catch blocks and logging frameworks like &lt;a href="https://logback.qos.ch/" rel="noopener noreferrer"&gt;Logback&lt;/a&gt; can be incredibly effective in handling errors and logging important information. For example, let's consider an API that handles errors:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;getUsers&lt;/span&gt;&lt;span class="o"&gt;()&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;try&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findAll&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt; &lt;span class="k"&gt;catch&lt;/span&gt; &lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nc"&gt;Exception&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
        &lt;span class="n"&gt;logger&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;error&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Error fetching users"&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
        &lt;span class="k"&gt;throw&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="nf"&gt;RuntimeException&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="n"&gt;e&lt;/span&gt;&lt;span class="o"&gt;);&lt;/span&gt;
    &lt;span class="o"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we're using a try-catch block to catch any exceptions that occur when fetching users, and logging the error using Logback.&lt;/p&gt;

&lt;h2&gt;
  
  
  Database Schema Design
&lt;/h2&gt;

&lt;p&gt;Database schema design is another critical aspect of building a production-grade REST API. We've found that using a tool like &lt;a href="https://hibernate.org/" rel="noopener noreferrer"&gt;Hibernate&lt;/a&gt; can be incredibly helpful in designing and managing our database schema. For example, let's consider a simple database schema:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;CREATE&lt;/span&gt; &lt;span class="k"&gt;TABLE&lt;/span&gt; &lt;span class="n"&gt;users&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;id&lt;/span&gt; &lt;span class="nb"&gt;INT&lt;/span&gt; &lt;span class="k"&gt;PRIMARY&lt;/span&gt; &lt;span class="k"&gt;KEY&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="n"&gt;name&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt;
    &lt;span class="n"&gt;email&lt;/span&gt; &lt;span class="nb"&gt;VARCHAR&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="mi"&gt;255&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we're creating a simple table called &lt;code&gt;users&lt;/code&gt; with three columns: &lt;code&gt;id&lt;/code&gt;, &lt;code&gt;name&lt;/code&gt;, and &lt;code&gt;email&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Mistakes
&lt;/h2&gt;

&lt;p&gt;Here are some common mistakes to avoid when building a Spring Boot REST API:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Not using meaningful resource names&lt;/li&gt;
&lt;li&gt;Not handling errors properly&lt;/li&gt;
&lt;li&gt;Not using the right HTTP methods&lt;/li&gt;
&lt;li&gt;Not logging important information&lt;/li&gt;
&lt;li&gt;Not securing your API properly&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Security Considerations
&lt;/h2&gt;

&lt;p&gt;Security is a critical aspect of building a production-grade REST API. We've found that using a combination of authentication and authorization mechanisms, such as &lt;a href="https://oauth.net/2/" rel="noopener noreferrer"&gt;OAuth&lt;/a&gt; and &lt;a href="https://jwt.io/" rel="noopener noreferrer"&gt;JWT&lt;/a&gt;, can be incredibly effective in securing our APIs. For example, let's consider an API that uses JWT to authenticate users:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="nd"&gt;@GetMapping&lt;/span&gt;
&lt;span class="kd"&gt;public&lt;/span&gt; &lt;span class="nc"&gt;List&lt;/span&gt;&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nc"&gt;User&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nf"&gt;getUsers&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="nd"&gt;@RequestHeader&lt;/span&gt;&lt;span class="o"&gt;(&lt;/span&gt;&lt;span class="s"&gt;"Authorization"&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="nc"&gt;String&lt;/span&gt; &lt;span class="n"&gt;token&lt;/span&gt;&lt;span class="o"&gt;)&lt;/span&gt; &lt;span class="o"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;// Verify the token and authenticate the user&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;userRepository&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;findAll&lt;/span&gt;&lt;span class="o"&gt;();&lt;/span&gt;
&lt;span class="o"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, we're using the &lt;code&gt;@RequestHeader&lt;/code&gt; annotation to get the &lt;code&gt;Authorization&lt;/code&gt; header, which contains the JWT token.&lt;/p&gt;

&lt;h2&gt;
  
  
  FAQ
&lt;/h2&gt;

&lt;h3&gt;
  
  
  What is the best way to handle errors in a Spring Boot REST API?
&lt;/h3&gt;

&lt;p&gt;We've found that using a combination of try-catch blocks and logging frameworks like Logback can be incredibly effective in handling errors and logging important information. For more information, check out the &lt;a href="https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#boot-features-error-handling" rel="noopener noreferrer"&gt;Spring documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I secure my Spring Boot REST API?
&lt;/h3&gt;

&lt;p&gt;We've found that using a combination of authentication and authorization mechanisms, such as OAuth and JWT, can be incredibly effective in securing our APIs. For more information, check out the &lt;a href="https://oauth.net/2/" rel="noopener noreferrer"&gt;OAuth documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is the best way to design a database schema for a Spring Boot REST API?
&lt;/h3&gt;

&lt;p&gt;We've found that using a tool like Hibernate can be incredibly helpful in designing and managing our database schema. For more information, check out the &lt;a href="https://hibernate.org/" rel="noopener noreferrer"&gt;Hibernate documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  How do I choose the right HTTP methods for my Spring Boot REST API?
&lt;/h3&gt;

&lt;p&gt;We've found that choosing the right HTTP method depends on the specific use case and the resources being interacted with. For more information, check out the &lt;a href="https://tools.ietf.org/html/rfc7231" rel="noopener noreferrer"&gt;RFC documentation&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, building a production-grade Spring Boot REST API requires careful consideration of several factors, including REST API design, error handling and logging, database schema design, security considerations, and more. By following the best practices outlined in this article, we can build fast, scalable, and secure APIs that meet the needs of our users. For more information, check out the &lt;a href="https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/" rel="noopener noreferrer"&gt;Spring Boot documentation&lt;/a&gt;.&lt;/p&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsource.unsplash.com%2F1000x500%2F%3Fjava%2Cprogramming%2Ccode%26sig%3D2" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fsource.unsplash.com%2F1000x500%2F%3Fjava%2Cprogramming%2Ccode%26sig%3D2" alt="Spring Boot Rest Api Best Practices in production" width="800" height="400"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Further Reading
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/" rel="noopener noreferrer"&gt;Spring Boot Official Documentation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.baeldung.com/" rel="noopener noreferrer"&gt;Baeldung — Java &amp;amp; Spring Tutorials&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://docs.oracle.com/en/java/" rel="noopener noreferrer"&gt;Oracle Java Documentation&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;&lt;em&gt;Written by **Shubham Bhati&lt;/em&gt;* — Backend Engineer at AlignBits LLC, specializing in Java 17, Spring Boot, microservices, and AI integration. Connect on &lt;a href="https://linkedin.com/in/bhatishubham" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;, &lt;a href="https://github.com/Shubh2-0" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;, or read more at &lt;a href="https://shubh2-0.github.io" rel="noopener noreferrer"&gt;shubh2-0.github.io&lt;/a&gt;.*&lt;/p&gt;

</description>
      <category>java</category>
      <category>springboot</category>
      <category>restapi</category>
      <category>backend</category>
    </item>
    <item>
      <title>From B.Com to Backend Engineer: My Masai School Journey</title>
      <dc:creator>Shubham Bhati</dc:creator>
      <pubDate>Sat, 16 May 2026 17:58:53 +0000</pubDate>
      <link>https://forem.com/shubham_bhati/from-bcom-to-backend-engineer-my-masai-school-journey-1053</link>
      <guid>https://forem.com/shubham_bhati/from-bcom-to-backend-engineer-my-masai-school-journey-1053</guid>
      <description>&lt;h1&gt;
  
  
  From B.Com to Backend Engineer: My Masai School Journey
&lt;/h1&gt;

&lt;p&gt;&lt;em&gt;By Shubham Bhati — Backend Engineer at AlignBits LLC&lt;/em&gt;&lt;/p&gt;




&lt;h2&gt;
  
  
  The unlikely path
&lt;/h2&gt;

&lt;p&gt;I have a Bachelor of Commerce degree from Devi Ahilya Vishwavidyalaya in Indore. Three years later, I'm a Software Engineer at an iPaaS company, shipping production Java microservices that integrate enterprise systems.&lt;/p&gt;

&lt;p&gt;In between those two facts is one institution that changed my trajectory: &lt;strong&gt;Masai School&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;This is the honest version of how I went from balance sheets to backend systems — what worked, what was hard, and what I'd do differently.&lt;/p&gt;




&lt;h2&gt;
  
  
  Why a B.Com grad picks up Java
&lt;/h2&gt;

&lt;p&gt;I didn't grow up writing code. My undergrad was accounting, taxation, business law. By the final year of B.Com (2022), I had a clear realization: the work I was being prepared for didn't excite me. The work that did — building software — required skills my degree never gave me.&lt;/p&gt;

&lt;p&gt;I had two options:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Spend ₹4–8 lakh on a Master's degree&lt;/li&gt;
&lt;li&gt;Find a focused, intensive program that taught backend engineering for software jobs&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;I picked option 2 and applied to &lt;strong&gt;Masai School&lt;/strong&gt; for their Software Engineering — Java Backend Specialization (then a 30+ week program in Bengaluru).&lt;/p&gt;




&lt;h2&gt;
  
  
  What Masai actually teaches
&lt;/h2&gt;

&lt;p&gt;Forget the marketing. What I actually learned, in order:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 1 — Foundations (HTML/CSS/JS, DSA)&lt;/strong&gt;&lt;br&gt;
Surprisingly tough. As a non-engineering grad, the first month was just adapting to "thinking like a programmer" — abstraction, recursion, big-O.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 2 — Java + OOP&lt;/strong&gt;&lt;br&gt;
Where the Java backend specialization really started. Generic types, collections framework, exception handling, multithreading basics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 3 — Spring Boot + databases&lt;/strong&gt;&lt;br&gt;
The career-defining phase. REST APIs, Spring Data JPA, Hibernate, MySQL. By week 18, I was building functional CRUD APIs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 4 — Production-grade&lt;/strong&gt;&lt;br&gt;
Spring Security, JWT, OAuth 2.0, microservices patterns, message queues (RabbitMQ basics).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Phase 5 — Capstone projects&lt;/strong&gt;&lt;br&gt;
Real, deployable projects. Mine included &lt;a href="https://github.com/Shubh2-0/Chatterbox" rel="noopener noreferrer"&gt;Chatterbox (Spring Boot WebSockets)&lt;/a&gt; and a &lt;a href="https://github.com/Shubh2-0/Shopzilla-Online-Shopping-Platform" rel="noopener noreferrer"&gt;Shopzilla e-commerce backend&lt;/a&gt;.&lt;/p&gt;




&lt;h2&gt;
  
  
  What worked
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Showing up every day&lt;/strong&gt;&lt;br&gt;
Masai is intense — 9–10 hours of focused work, six days a week. The students who showed up consistently are the ones who got hired. Talent matters less than this.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Building things outside class&lt;/strong&gt;&lt;br&gt;
I built side projects on weekends. &lt;a href="https://github.com/Shubh2-0/SnapResize" rel="noopener noreferrer"&gt;SnapResize&lt;/a&gt;, &lt;a href="https://github.com/Shubh2-0/TIC_TAC_TOE_Game_With_JAVAFX" rel="noopener noreferrer"&gt;TIC_TAC_TOE with JavaFX&lt;/a&gt;, and &lt;a href="https://github.com/Shubh2-0/WorkFolio" rel="noopener noreferrer"&gt;WorkFolio&lt;/a&gt; — these became my real portfolio.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Studying production code&lt;/strong&gt;&lt;br&gt;
Reading open-source Spring projects taught me more than tutorials ever did.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4. Practicing Java interview problems daily&lt;/strong&gt;&lt;br&gt;
HackerRank, LeetCode (easy/medium). I have an &lt;a href="https://www.hackerrank.com/profile/shubhambhati226" rel="noopener noreferrer"&gt;Intermediate badge for Java on HackerRank&lt;/a&gt; — earned by daily practice.&lt;/p&gt;




&lt;h2&gt;
  
  
  What didn't work (or what I'd change)
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. Spreading too thin&lt;/strong&gt;&lt;br&gt;
I tried to learn React + Java backend simultaneously in the first months. Mistake. Going deep on one stack beats being mediocre at two.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. Skipping system design early&lt;/strong&gt;&lt;br&gt;
Masai covers basics, but interview-grade system design (LB, caching, partitioning, CAP, consistent hashing) — I learned that mostly on the job after joining IHX. Should have started earlier.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. Not building public presence&lt;/strong&gt;&lt;br&gt;
I waited until job-search stage to make a GitHub portfolio. Should have been pushing code from week 1. Recruiters search GitHub more than they admit.&lt;/p&gt;




&lt;h2&gt;
  
  
  What happened after Masai
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;IHX Private Limited (Jun 2023 – Aug 2024)&lt;/strong&gt; — Associate Software Engineer on healthcare backend systems. FHIR-standard integrations. This is where I learned production engineering: incidents, on-call, monitoring, SLOs.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;AlignBits LLC (Sep 2024 – present)&lt;/strong&gt; — Software Engineer on an iPaaS platform. Microservices at scale, message queues, AWS, cross-system integrations. Got promoted from Jr. in my first year.&lt;/p&gt;

&lt;p&gt;In two years from graduating Masai I've:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Resolved 15+ production incidents&lt;/li&gt;
&lt;li&gt;Managed 10+ client integration pipelines&lt;/li&gt;
&lt;li&gt;Earned 25+ certifications (AI Engineer, Java, Prompt Engineering)&lt;/li&gt;
&lt;li&gt;Stayed at backend engineering — never had to pivot&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Is Masai worth it?
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;Honest answer: yes, conditionally.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;It's worth it if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You're committed to backend engineering as a career&lt;/li&gt;
&lt;li&gt;You can dedicate 9+ hours/day for 30+ weeks&lt;/li&gt;
&lt;li&gt;You have no engineering background and need structured fundamentals&lt;/li&gt;
&lt;li&gt;You're OK with the pay-after-placement model (you don't pay until you're earning)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It's NOT worth it if:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;You're looking for a credential to put on a resume without doing the work&lt;/li&gt;
&lt;li&gt;You already know Java and Spring well — you'll be bored in the first half&lt;/li&gt;
&lt;li&gt;You can't commit full-time&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  What I'd tell a B.Com student today
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Pick one stack, go deep.&lt;/strong&gt; Don't be a full-stack jack-of-all-trades. Java + Spring Boot is a solid bet for India in 2026.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Push code to GitHub from day one.&lt;/strong&gt; Even bad code. Recruiters notice consistency.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Get a working website.&lt;/strong&gt; Mine is at &lt;a href="https://shubh2-0.github.io" rel="noopener noreferrer"&gt;shubh2-0.github.io&lt;/a&gt;. It pulls more recruiter messages than my LinkedIn.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Solve 1 LeetCode problem a day.&lt;/strong&gt; Not 10. One, every day, for a year.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Find a community.&lt;/strong&gt; I'd struggled alone for months before joining Masai. Don't.&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;I'm currently exploring backend engineering roles — remote, hybrid, or relocation — with companies building products that scale. If you're hiring or know someone who is, my &lt;a href="https://linkedin.com/in/bhatishubham" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt; is the fastest way to reach me.&lt;/p&gt;

&lt;p&gt;If you're a B.Com student staring at a coding bootcamp wondering if it's worth it: it is, if you do the work.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;Shubham Bhati is a Backend Engineer at AlignBits LLC, working on iPaaS platform integrations with Java, Spring Boot, and AWS. Based in Gurgaon, India. &lt;a href="https://shubh2-0.github.io" rel="noopener noreferrer"&gt;Portfolio&lt;/a&gt; · &lt;a href="https://github.com/Shubh2-0" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt; · &lt;a href="https://linkedin.com/in/bhatishubham" rel="noopener noreferrer"&gt;LinkedIn&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;&lt;strong&gt;Publishing checklist:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;[ ] Add 2-3 images (Masai campus photo, your code screenshot, a system diagram)&lt;/li&gt;
&lt;li&gt;[ ] Cover image: 1200x675 px (Canva)&lt;/li&gt;
&lt;li&gt;[ ] Tags: &lt;code&gt;#masaischool&lt;/code&gt; &lt;code&gt;#javadeveloper&lt;/code&gt; &lt;code&gt;#careerchange&lt;/code&gt; &lt;code&gt;#bcomtocoding&lt;/code&gt; &lt;code&gt;#backenddeveloper&lt;/code&gt; &lt;code&gt;#java&lt;/code&gt; &lt;code&gt;#springboot&lt;/code&gt; &lt;code&gt;#india&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;[ ] Add canonical link back to your bio site&lt;/li&gt;
&lt;li&gt;[ ] Cross-post to Dev.to and Hashnode after 24h (Medium gets first crawl)&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>java</category>
      <category>career</category>
      <category>masaischool</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
