GenAIDecember 4, 20269 min

Spring AI 2.0: do you still need Python for an enterprise GenAI application?

What Spring AI 2.0 covers, what Python keeps, and the decision grid we use when scoping projects.

TL;DR

  1. 01An enterprise GenAI application is integration first
  2. 02Spring AI 2.0 covers the essentials
  3. 03Python keeps model building
  4. 04If you consume models, Spring is enough; if you build them, Python remains essential.
  5. 05Spring at the centre, Python at the edges

The starting point

Since 2023, generative AI has spoken Python. Model providers ship their SDKs in Python first, LangChain and LlamaIndex were born there, and almost every tutorial uses it. As a result, in many companies the first GenAI assistant was a Python microservice sitting next to the Spring applications that run the business.

The prototype ships fast. Industrialisation, much less so: two stacks to maintain, two CI/CD pipelines, two security models, observability split in two and scarce skills to hire.

Since 12 June 2026, Spring AI 2.0 has been generally available, aligned with Spring Boot 4. The question is no longer "can you do GenAI in Java?" but "where does Python still bring value that Spring cannot offer?"

What Spring AI 2.0 can do

Spring AI applies to generative AI what Spring has always done: a portable abstraction, configured by Spring Boot, injected like any other bean. You switch model provider through configuration, not by rewriting code.

The building blocks

  • ChatClient: the main API for talking to a model. It handles prompts, conversation history and structured outputs (a model response converted directly into a Java object).
  • Providers: OpenAI, Anthropic, Google GenAI, Amazon Bedrock, Mistral AI, DeepSeek, and Ollama for models hosted on your own infrastructure. Version 2.0 builds on the official OpenAI, Anthropic and Google SDKs.
  • RAG (Retrieval Augmented Generation): you index your documents in a vector store (PostgreSQL with pgvector, Elasticsearch, Redis…), then the model answers based on the retrieved passages rather than on its memory alone.
  • Tool calling: the model can decide to call a Java method, for example to look up an order or a stock level.

What 2.0 really changes

  • A composable tool loop. In 1.x, each model ran its own tool-calling loop, which could not be intercepted. In 2.0, it becomes an advisor (ToolCallingAdvisor) in the ChatClient chain. This is the foundation for building real agents.
  • Hundreds of tools. ToolSearchToolCallingAdvisor only shows the model the tools it needs, on demand, instead of sending all of them with every request.
  • Self-correcting structured outputs. StructuredOutputValidationAdvisor asks the model again when its JSON does not match the expected schema.
  • Native MCP. The Model Context Protocol is becoming the standard for connecting tools to an assistant. The Spring team maintains the official MCP Java SDK, and a single annotation is enough to expose a Spring service: @McpTool, @McpResource, @McpPrompt.
  • The Spring Boot 4 foundation: Jackson 3, JSpecify null-safety, immutable options built with builders.

What it looks like

An assistant that answers customer questions by querying the real order system, in a standard Spring Boot application:

An assistant connected to the existing order service
AssistantController.java
@Componentclass CommandeTools {     private final CommandeService commandes; // your existing business service     CommandeTools(CommandeService commandes) { this.commandes = commandes; }     @Tool(description = "Order status from its number")    StatutCommande statut(String numero) {        return commandes.statut(numero); // same access rules, same transactions    }} @RestControllerclass AssistantController {     private final ChatClient chat;    private final CommandeTools tools;     AssistantController(ChatClient.Builder builder, CommandeTools tools) {        this.chat = builder.defaultSystem("You are the customer service assistant.").build();        this.tools = tools;    }     @PostMapping("/assistant")    String repondre(@RequestBody String question) {        return chat.prompt().user(question).tools(tools).call().content();    }}

No new service, no new language: the tool calls the CommandeService that is already tested, secured and monitored. For a beginner, this is the key point: AI becomes one more dependency in the project, not a separate project.

What Python keeps

Let's be honest: Python has not lost its place. It has simply narrowed it. Everything to do with building models and experimenting remains its territory. Everything to do with integrating them into the IT system becomes Spring's.

Fig. 01 · Spring AI 2.0 and Python

Integrating models goes to Spring, building them stays with Python

NeedSpring AI 2.0Python ecosystemVerdict
Call a model through an APIChatClient, 7 native providers and OpenAI-compatible APIsOfficial SDKs, LangChainTie
RAG on business dataVector stores, RAG advisors, PDF and Tika readersLlamaIndex, LangChain, more advanced document analysisSpring is enough, except for complex documents
Agents and toolsComposable tool loop, native MCPLangGraph, CrewAI, more examples and patternsPython ahead, Spring to connect the IT system
Security and permissionsSpring Security, OAuth 2.0 on MCPTo be rebuilt in the serviceSpring wins
ObservabilityMicrometer, OpenTelemetry, already in your dashboardsLLM-specific tools (Langfuse, LangSmith)Spring wins for operations
Evaluate answer qualityBasic evaluators (relevancy, fact-checking)Ragas, DeepEval, analysis notebooksPython wins
Train or fine-tune a modelOut of scopePyTorch, Hugging FacePython is essential
Data science explorationOut of scopepandas, JupyterPython is essential

Source: Spring AI 2.0.0 GA announcement (spring.io, 12 June 2026) · Adservio field experience.

The dividing line is clear. Spring AI does not try to replace PyTorch or notebooks, and Python is no better than Spring at handling a transaction, an access right or a distributed trace. On the Java side, LangChain4j is also a serious alternative, but Spring AI has the advantage of native integration with Spring Boot.

From the field: what we see on projects

On the GenAI projects we support, the difficulty is rarely the model. It almost always lies in what surrounds it.

  • The Python POC that never reaches production. The scenario is a classic: a convincing demo in a few weeks, then months of deadlock. The operations team does not know how to deploy or monitor the service, security asks how it handles authentication, and nobody wants to maintain it. The problem is not Python, it is an orphan service in an IT system that was not built for it.
  • Most of the code is not AI. In a business assistant, the model call fits in a few lines. The rest is fetching data, checking permissions, calling existing services, logging, handling errors. That is exactly what your Spring teams do every day.
  • The RAG that says too much. The most serious trap: an assistant that answers with a document the user should never have seen. Access rights must apply at search time, filtering documents according to the logged-in user. When the assistant lives inside the Spring application, that security context is already there. In a separate Python service, it has to be passed along and rebuilt.
  • Document ingestion, the real work. Scanned PDFs, tables, diagrams, multiple versions of the same document: the quality of a RAG is decided here, well before the choice of model. It is also where the Python ecosystem keeps its clearest lead. We often isolate this ingestion in a dedicated batch process, which can be in Python, while the application that queries stays in Spring.
  • The surprise bill. Every model call costs tokens. Without metrics, you discover consumption on the provider's invoice. Spring AI publishes token usage through Micrometer: you show it in your existing dashboards and set alerts as for any other indicator.
  • Switching provider. Requests for sovereignty and cost control come up often: moving from an American model to Mistral AI, or to a model hosted in-house with Ollama. With the Spring AI abstraction, it is first a change of dependency and configuration, then a test campaign to check answer quality.
  • Skills. The rare know-how is not the language. It is knowing how to write a good prompt, split a document, evaluate an answer and detect a hallucination. A Spring developer learns this in a few weeks. Asking them to learn a new stack on top of that doubles the step.

Which choice for your case

The right question is not "Java or Python?" but "what am I building?". Here is the grid we use when scoping projects.

Fig. 02 · Adservio scoping grid

Start from what you are building, not from the language

Your caseOur recommendationWhy
Assistant or chatbot built into an existing business applicationAll SpringThe data, permissions and services are already there
RAG on clean internal documentation (web pages, Markdown, text PDFs)All SpringDocument readers and vector stores are enough
RAG on complex documents (scans, tables, diagrams)Ingestion in Python, querying in SpringPython stays ahead on document analysis
Expose business services to AI agentsSpring with MCPOne annotation per tool, with Spring security
Experimental autonomous agent, in exploration phasePython to explore, Spring to industrialiseMore examples and frameworks on the Python side
Specific model to train or fine-tunePython, exposed through an APISpring AI does not do training
Data science team already in place, Java team alongsideBoth, with a clear API contractEach keeps its area of excellence

In blue: the two most frequent cases in the requests we receive.

In most of the requests we receive, the first two rows are enough to describe the need.

The architecture we recommend

Spring at the centre, Python at the edges. The Spring application carries the user experience, the orchestration of model calls, permissions and monitoring. Python only steps in where it brings value that Spring lacks, behind a clear contract.

  • The Spring Boot 4 and Spring AI 2.0 application receives the request, applies Spring Security, builds the prompt, queries the vector store with permission filters, and calls the model and the business tools.
  • Existing business services are exposed as tools, directly in the application or through a Spring MCP server, so that other assistants and agents can reuse them.
  • The ingestion pipeline feeds the vector store. It runs in Spring (Spring Batch and document readers) when documents are simple, in Python when they need advanced analysis.
  • Specific models, if any, are trained by the data team in Python and served behind an OpenAI-compatible API. For Spring AI, it is just one more provider.
  • Monitoring goes through Micrometer and OpenTelemetry: latency, errors, tokens consumed and cost, in the same dashboards as the rest of the IT system.

The point to watch is the contract between the two worlds. A versioned HTTP API or an MCP server, tested like any other integration, is better than shared access to the same database.

And AI in the project lifecycle?

This time, AI is not just a tool for building the application: it becomes one of its components. That changes three moments in the lifecycle.

  • Design. From the scoping stage, you define what the assistant is allowed to do: which tools it can call, on which data, with which human confirmation for actions that change something. A tool that writes to the database is not a tool that reads.
  • Testing. A model response is not deterministic, an assertEquals is no longer enough. You keep classic tests for the tools and the surrounding code, and add a set of reference questions evaluated at every prompt or model change, with Spring AI's evaluators or dedicated evaluation tooling. This is often where a Python notebook remains useful, to analyse the results.
  • Development. A coding agent is very effective at writing Spring AI integration code: configuration, tools, advisors, tests. It is much less so at deciding what a tool is allowed to do. That decision stays human, and it is reviewed in code review like a security rule.

Our position

For an enterprise GenAI application, Python is no longer the default choice. It goes back to what it does best: the tool of data scientists, of experimentation and of model building.

Key takeaway

Creating a Python stack just to call a model's API means paying for two platforms to get the benefit of one. If your IT system runs on Spring, your generative AI has every reason to run on it too.

Keeping or creating a Python service can be justified: a data team already in place, an in-house model, demanding document processing. But it is an architecture decision to be made explicitly, with an API contract and someone accountable for operations, not a reflex inherited from the first tutorials.

What about you: is your first GenAI assistant in Python, in Java, or a mix of both? What drove that choice?

Is your GenAI assistant ready for production?We review your case with you, using the scoping grid from this article.Talk to an expert

Further reading

Next in the Inside Java Architecture series: coding a Spring project with an AI agent, what really works.

Want to start with the first issue?Inside Java Architecture #01: Migrating to Spring Boot 4, what really breaks (in French). We invite you to read it first: Spring Boot 4 is the foundation of Spring AI 2.0.Read #01 on LinkedIn

Serge Gildas Ayepi, Practice Manager Java / Spring

Inside Java ArchitectureSpring AISpring Boot 4JavaPythonGenAIRAGMCPAI agentsArchitecture
Download the PDF
Share
TALK TO AN EXPERT

Put these ideas into practice

Talk to our engineers about how this applies to your platform, your data and your teams.

By submitting this form, you agree to our privacy policy.

Frequently Asked Questions

Yes. Since 12 June 2026, Spring AI 2.0 has been generally available, aligned with Spring Boot 4. It covers model calls, RAG, tool calling, agents, MCP, structured outputs and observability.

For building models: training and fine-tuning, data science exploration. Python also stays ahead on advanced document processing (scans, tables, diagrams) and on answer evaluation tooling.

OpenAI, Anthropic, Google GenAI, Amazon Bedrock, Mistral AI, DeepSeek, and Ollama for models hosted on your own infrastructure. You switch provider through configuration, not by rewriting code.

Spring at the centre, Python at the edges. The Spring application carries the user experience, the orchestration of model calls, permissions and monitoring; Python only steps in where it brings value that Spring lacks, behind a clear API contract.