In the print dialog, choose “Save as PDF”.
Adservio

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.

ADSERVIO INSIGHTS · GENAI

CATEGORYGenAI
READING TIME9 min
DATE4 December 2026
FORMATAdservio Insights article
CONTACThello@adservio.fr

KEY POINTS

  • An enterprise GenAI application is integration first: data, permissions, business services, monitoring, not data science.
  • Spring AI 2.0 covers the essentials: model calls, RAG, tool calling, agents, MCP, structured outputs, observability.
  • Python keeps model building: training and fine-tuning, data science experimentation, advanced document processing, richer evaluation tooling.
  • If you consume models, Spring is enough; if you build them, Python remains essential.
  • Spring at the centre, Python at the edges: Python steps in when it brings real value.

SECTION 1

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?"

SECTION 2

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

@Component
class 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
    }
}

@RestController
class 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.

SECTION 3

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.

Interactive figure: see the online version of the article

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.

SECTION 4

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.

SECTION 5

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.

Interactive figure: see the online version of the article

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

SECTION 6

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.

SECTION 7

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.

SECTION 8

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?

Take action

Is your GenAI assistant ready for production?

We review your case with you, using the scoping grid from this article.

Talk to an expert : adservio.fr/contact

SECTION 9

Further reading

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

Take action

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 : linkedin.com/pulse/inside-java-architecture-01-migrer-vers-spring-boot-4-ayepi-edrje/

FAQ

Frequently asked questions

Can you build generative AI in Java?

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.

When does Python remain essential?

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.

Which model providers does Spring AI 2.0 support?

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.

Which architecture do you recommend for an enterprise GenAI application?

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.

ABOUT ADSERVIO

Adservio is a collective of augmented engineering experts: AI-augmented IT departments, software engineering, DevOps, MLOps, cybersecurity and AI governance.

Let's talk about your project: hello@adservio.fr · adservio.fr/contact