<?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>DEV Community: Rohit Srivastava</title>
    <description>The latest articles on DEV Community by Rohit Srivastava (@iamrohit0229).</description>
    <link>https://dev.to/iamrohit0229</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.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F813553%2Fadeba9a8-1d4c-4107-b607-be578abf2193.png</url>
      <title>DEV Community: Rohit Srivastava</title>
      <link>https://dev.to/iamrohit0229</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/iamrohit0229"/>
    <language>en</language>
    <item>
      <title>Spring AI for Skeptical Engineers</title>
      <dc:creator>Rohit Srivastava</dc:creator>
      <pubDate>Mon, 23 Nov 2026 08:57:32 +0000</pubDate>
      <link>https://dev.to/iamrohit0229/spring-ai-for-skeptical-engineers-3098</link>
      <guid>https://dev.to/iamrohit0229/spring-ai-for-skeptical-engineers-3098</guid>
      <description>&lt;h1&gt;
  
  
  Spring AI Is Not an OpenAI Wrapper🚫
&lt;/h1&gt;

&lt;p&gt;Most people meet Spring AI through a five-line demo: add a starter, inject a client, ask a question, get an answer. It looks like a thin convenience layer over a model provider's API.&lt;/p&gt;

&lt;p&gt;That reading misses the point, and it leads to bad adoption decisions in both directions: teams that over-trust it and teams that dismiss it.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;This article is the foundation for &lt;strong&gt;why Spring AI exists, where it came from, what its parts are, how a request flows through it, and where it fits and doesn't.&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  1. Why it exists
&lt;/h2&gt;

&lt;p&gt;Most enterprise backends run on the JVM, but much of the early generative AI tooling was built Python-first. A Java team that wanted to add an LLM feature faced a few problems:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Every provider has its own SDK&lt;/strong&gt;, request shape, and streaming behavior. Code written against one is expensive to move.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;AI features need the same plumbing as any other feature:&lt;/strong&gt; configuration, dependency injection, retries, metrics, tracing, testing. Re-inventing this around a raw HTTP client is wasteful.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The real work isn't the model call.&lt;/strong&gt; It's everything around it: pulling in your own data, turning free-text output into typed objects, letting the model trigger your business logic, and keeping conversation state.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Running a separate Python service&lt;/strong&gt; is a valid answer, but it adds a new runtime, deployment pipeline, and team skill set.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Spring AI's stated goal is to connect enterprise data and APIs with AI models using the conventions Spring developers already know: auto-configuration, starters, portable abstractions, and POJOs.&lt;/p&gt;




&lt;h2&gt;
  
  
  2. Where it came from
&lt;/h2&gt;

&lt;p&gt;The project's own documentation says it was &lt;strong&gt;inspired by Python projects such as LangChain and LlamaIndex, but is not a direct port.&lt;/strong&gt; The bet is that the next wave of AI applications won't be Python-only.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Period&lt;/th&gt;
&lt;th&gt;Milestone&lt;/th&gt;
&lt;th&gt;What it meant&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;2023&lt;/td&gt;
&lt;td&gt;Project starts as an experimental Spring project&lt;/td&gt;
&lt;td&gt;Early design work, fast-changing, no stability promise&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Early 2024&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;0.8.x&lt;/strong&gt; public releases&lt;/td&gt;
&lt;td&gt;First versions teams could try. Core abstractions for chat, embeddings, and vector stores.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Late 2024 to spring 2025&lt;/td&gt;
&lt;td&gt;
&lt;strong&gt;1.0.0 milestones (M1 to M8)&lt;/strong&gt; and release candidates&lt;/td&gt;
&lt;td&gt;Heavy iteration. The &lt;code&gt;ChatClient&lt;/code&gt; fluent API, Advisors, a reworked tool-calling model, and renamed starter artifacts.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;May 2025&lt;/td&gt;
&lt;td&gt;&lt;strong&gt;1.0.0 GA&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;The first generally available release, and the point where it became reasonable to build on&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;strong&gt;Why the history matters to you:&lt;/strong&gt; if you search for Spring AI tutorials, a lot of what you find was written against pre-1.0 versions. Class names, starter artifact names, and tool-calling APIs changed along the way, so old snippets frequently don't compile on current versions. When in doubt, check the version in the tutorial's &lt;code&gt;pom.xml&lt;/code&gt; first.&lt;/p&gt;




&lt;h2&gt;
  
  
  3. What it is: a map of the pieces
&lt;/h2&gt;

&lt;p&gt;Think of it as a set of Spring-style abstractions, not one library. Each has an analogy you probably already know.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Piece&lt;/th&gt;
&lt;th&gt;What it does&lt;/th&gt;
&lt;th&gt;Spring analogy&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;
&lt;strong&gt;Model abstractions&lt;/strong&gt; (chat, embedding, image, and others)&lt;/td&gt;
&lt;td&gt;A common interface over many providers&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;DataSource&lt;/code&gt; / JDBC: one API, many vendors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;&lt;code&gt;ChatClient&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Fluent API to build a prompt, call a model, and read the result&lt;/td&gt;
&lt;td&gt;
&lt;code&gt;WebClient&lt;/code&gt; / &lt;code&gt;RestClient&lt;/code&gt;
&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Prompt templates&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Parameterized prompts kept out of business code&lt;/td&gt;
&lt;td&gt;Template engines&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Structured output&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Map model text into typed Java objects&lt;/td&gt;
&lt;td&gt;Jackson and message converters&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Tool calling&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Let the model &lt;em&gt;request&lt;/em&gt; that your app run a Java method&lt;/td&gt;
&lt;td&gt;A controller the model can ask to invoke&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Advisors&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Intercept requests and responses to add behavior&lt;/td&gt;
&lt;td&gt;Servlet filters / AOP interceptors&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Chat memory&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Keep conversation context across calls&lt;/td&gt;
&lt;td&gt;Session storage&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Embeddings + &lt;code&gt;VectorStore&lt;/code&gt;&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Store and search text by meaning&lt;/td&gt;
&lt;td&gt;Spring Data repositories over many stores&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Document ingestion (ETL)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Read, split, embed, and load your data&lt;/td&gt;
&lt;td&gt;A batch pipeline&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Observability&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Metrics and tracing around model calls&lt;/td&gt;
&lt;td&gt;Micrometer&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Auto-configuration and starters&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Wire it all from properties and dependencies&lt;/td&gt;
&lt;td&gt;Spring Boot itself&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;One idea to hold on to: &lt;strong&gt;the model never runs anything.&lt;/strong&gt; In tool calling, it returns a request ("call this method with these arguments"), and your application decides whether to execute it. That detail drives the security discussion in the next post.&lt;/p&gt;




&lt;h2&gt;
  
  
  4. How one call flows
&lt;/h2&gt;

&lt;p&gt;Conceptually, a single request moves like this:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;Your code&lt;/strong&gt; builds a request through &lt;code&gt;ChatClient&lt;/code&gt;: a system instruction, the user's message, and optionally tools and options.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Advisors run in order&lt;/strong&gt;, each able to read or change the request. Typical jobs: attach memory, retrieve documents, redact data, log.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The request is translated&lt;/strong&gt; into the chosen provider's format and sent to the model.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The model responds&lt;/strong&gt; with text, or with a request to call one of your tools.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;If a tool is requested,&lt;/strong&gt; the framework runs your method, sends the result back to the model, and repeats until the model produces a final answer.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The response travels back through the advisors,&lt;/strong&gt; then is returned as raw text or converted into a typed object.&lt;/li&gt;
&lt;/ol&gt;




&lt;blockquote&gt;
&lt;p&gt;Spring AI is Spring's answer to a specific problem: putting LLMs inside existing Java services without rewriting everything around one provider's SDK. Like &lt;code&gt;JdbcTemplate&lt;/code&gt; or Spring Data, the abstraction is valuable until it leaks. Knowing where it leaks is the skill.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  5. Where the abstraction leaks
&lt;/h2&gt;

&lt;p&gt;Every abstraction leaks, and with LLMs the leaks are bigger than with databases.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;⚠️&lt;strong&gt;Portable API does not mean portable behavior.&lt;/strong&gt; Swapping a provider is easy in configuration. But the same prompt can produce different quality, different tool-calling reliability, and different structured-output accuracy on different models. Plan to re-test, not just re-configure.&lt;/li&gt;
&lt;li&gt;⚠️&lt;strong&gt;Model capabilities differ.&lt;/strong&gt; Not every model supports tool calling, structured output, or streaming equally. The framework can't add a capability the model lacks.&lt;/li&gt;
&lt;li&gt;⚠️&lt;strong&gt;Provider-specific options still exist.&lt;/strong&gt; Some useful features live only in one provider's options, and using them reduces your portability.&lt;/li&gt;
&lt;li&gt;⚠️&lt;strong&gt;Behavior is non-deterministic.&lt;/strong&gt; No framework can make an LLM predictable. Lower temperature reduces variance but doesn't remove it.&lt;/li&gt;
&lt;li&gt;⚠️&lt;strong&gt;The framework moves quickly.&lt;/strong&gt; Even after 1.0, the AI ecosystem changes fast. Expect new features and occasional deprecations, so pin versions and read release notes.&lt;/li&gt;
&lt;li&gt;⚠️&lt;strong&gt;Defaults aren't policies.&lt;/strong&gt; Auto-configuration gives you a working setup, not a safe, cost-controlled, or compliant one.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  6. Where it fits, and where it doesn't
&lt;/h2&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Option&lt;/th&gt;
&lt;th&gt;Good when&lt;/th&gt;
&lt;th&gt;Watch out for&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Spring AI&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;You're a Spring shop adding AI features to existing services and want familiar configuration, testing, and observability&lt;/td&gt;
&lt;td&gt;Younger API surface, and you inherit the abstraction's leaks&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;Provider's own Java SDK&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;You're committed to one provider and need its newest features immediately&lt;/td&gt;
&lt;td&gt;Lock-in, and you rebuild glue like memory, tools, and retrieval yourself&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;LangChain4j&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;You want a mature, Java-native alternative, possibly outside Spring, or prefer its programming model&lt;/td&gt;
&lt;td&gt;Different abstractions and conventions. Evaluate it against your needs.&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;A separate Python service&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;Your team already has Python AI expertise, or you need Python-only libraries&lt;/td&gt;
&lt;td&gt;Extra runtime, deployment, network hop, and ownership split&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;strong&gt;No framework (plain HTTP)&lt;/strong&gt;&lt;/td&gt;
&lt;td&gt;A single, simple call with no tools, memory, or retrieval&lt;/td&gt;
&lt;td&gt;You'll slowly rebuild a framework as requirements grow&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;A rule of thumb:&lt;/strong&gt; if your AI feature is one prompt in and one answer out, a framework may be overkill. If it needs tools, retrieval, memory, observability, and several providers over time, the framework starts paying for itself.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  7. Questions to ask before adopting
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Which actions should the model be allowed to trigger, and which must never be reachable from it?&lt;/li&gt;
&lt;li&gt;What data would leave our network, and does our provider contract allow it?&lt;/li&gt;
&lt;li&gt;How will we measure cost and quality over time, not just whether it works today?&lt;/li&gt;
&lt;li&gt;What happens when the provider is slow, down, or changes model behavior?&lt;/li&gt;
&lt;li&gt;If we had to switch providers, what would we need to re-test?&lt;/li&gt;
&lt;/ol&gt;




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

&lt;p&gt;The next post moves from concepts to practice, starting with one of the biggest risks in this list: letting a model call your business logic safely.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Corrections welcome. If something here is out of date for the version you're using, tell me in the comments.👇&lt;/em&gt;&lt;/p&gt;

</description>
      <category>ai</category>
      <category>backend</category>
      <category>java</category>
      <category>softwareengineering</category>
    </item>
  </channel>
</rss>
