Spring AI: the rise of Java in the AI era

If you’re a Java developer who has been watching the AI space from the sidelines, waiting for the ecosystem to catch up, that wait is over. Spring AI has gone from an early experiment to a fully supported, production-grade framework in under two years. With version 1.1 GA shipped in November 2025 and 2.0 milestones already landing, this is the right time to take a serious look.

Why Spring AI matters

The AI application landscape has been dominated by Python. LangChain, LlamaIndex, the OpenAI SDK - everything assumes you’re writing Python. For teams running Java in production, this created an awkward choice: either maintain a separate Python service for AI features, or cobble together raw HTTP calls to model APIs and handle all the plumbing yourself.

Spring AI removes that choice entirely. It brings AI capabilities into the Spring ecosystem with the same conventions you already know: auto-configuration, dependency injection, starters, and a fluent API that feels native to Spring Boot.

The ChatClient

At the core of Spring AI is the ChatClient, a portable API for interacting with AI models. Think of it as RestClient but for LLMs. It supports 20+ model providers out of the box, from Anthropic Claude to OpenAI, Google Gemini, AWS Bedrock, Ollama, and many others.

1String answer = chatClient.prompt()
2    .user("Explain event sourcing in two sentences")
3    .call()
4    .content();

The fluent API supports multi-modal inputs, structured output mapping to POJOs, and streaming responses. Switching between model providers is a configuration change, not a code change.

Structured output

One of the more practical features is structured output conversion. Rather than parsing free-form text from a model, you can map responses directly to Java types:

1record Summary(String title, List<String> keyPoints, int confidence) {}
2
3Summary summary = chatClient.prompt()
4    .user("Summarize the latest quarterly report")
5    .call()
6    .entity(Summary.class);

This gives you type-safe AI responses that integrate cleanly with the rest of your application. No regex, no manual JSON parsing, no hoping the model returns something parseable.

Tool calling

Spring AI makes it straightforward to extend what models can do through tools. This is where AI goes from answering questions to actually doing things. You define a method, annotate it, and the model can call it when needed:

1@Tool(description = "Look up the current price for a given stock ticker")
2public StockPrice getStockPrice(@ToolParam("The stock ticker symbol") String ticker) {
3    return stockService.getCurrentPrice(ticker);
4}

The model decides when to call the tool based on the user’s request. Spring AI handles the function calling protocol, serialization, and response integration. This works across all providers that support tool calling.

Advisors and RAG

The Advisors API encapsulates recurring AI patterns. Need conversational memory? Add a MessageChatMemoryAdvisor. Need retrieval-augmented generation? Use QuestionAnswerAdvisor with a vector store:

1ChatClient client = chatClient.mutate()
2    .defaultAdvisors(
3        new MessageChatMemoryAdvisor(chatMemory),
4        new QuestionAnswerAdvisor(vectorStore)
5    )
6    .build();

Spring AI includes a full ETL pipeline for ingesting documents into vector stores, supporting sources like local files, S3, Azure Blob Storage, databases, and even GitHub repositories. The vector store abstraction supports PostgreSQL/pgvector, Redis, Elasticsearch, MongoDB, and many others.

MCP integration

Spring AI 1.1 brought first-class support for the Model Context Protocol (MCP), the open standard for connecting AI models to external tools and data sources. Adding MCP client support is as simple as including the starter:

1<dependency>
2    <groupId>org.springframework.ai</groupId>
3    <artifactId>spring-ai-starter-mcp-client</artifactId>
4</dependency>

Spring Boot auto-configuration handles the connection setup. Your application can consume tools exposed by any MCP server, whether it connects over stdio or HTTP. This is particularly powerful for connecting to existing tool ecosystems without writing custom integrations.

What’s coming in 2.0

Spring AI 2.0 is built on Spring Boot 4.0 and Spring Framework 7.0, with a GA release targeted for May 2026. The milestone releases already include:

  • Native integration with the official OpenAI Java SDK
  • Redis-based chat memory for persistent conversation management
  • New vector store backends including Amazon S3 and Infinispan
  • Improved MCP server auto-configuration
  • Java 21 baseline with null safety improvements

Should you adopt it?

If your team runs Java and you’re building AI features, the answer is straightforward: yes. Spring AI has reached the point where it’s not just viable but preferable over maintaining separate Python services. The API is stable, the model coverage is broad, and the integration with the broader Spring ecosystem means you get observability, security, and testing support without additional effort.

For teams already on Spring Boot 3.x, Spring AI 1.1 is production-ready today. If you’re planning a Spring Boot 4 migration, targeting Spring AI 2.0 GA in May makes sense.

The Java ecosystem has caught up. Time to build.