Spring AI 2.0 Gives Java a Native On-Ramp to LLM Chat with Redis-Backed Memory
Java teams that want LLM features no longer need to bolt on a separate service or hand-roll HTTP calls. Spring AI's abstraction and memory support cut integration time to a few configuration lines, and the OpenAI-compatible base-url means existing DeepSeek or OpenAI keys work as-is, making multi-vendor model swapping trivial.
Spring AI 2.0 extends the Spring ecosystem into AI, letting Java developers wire LLM chat into a project the same way they wire a database or a web controller. A single ChatClient bean wraps all the HTTP and streaming details; adding one starter dependency and a configuration class gets sync call() and stream() endpoints running. Because the OpenAI-compatible base-url accepts any compatible vendor, DeepSeek's endpoint works with the same code that targets OpenAI.
The conversation memory story is the practical centerpiece. Without it, every prompt looks like a first conversation. Spring AI's ChatMemory interface and its Redis repository store message history per conversationId, and a few lines in the controller fetch prior context, add new user and assistant messages, and clear history. The walkthrough covers launching redis-stack via Docker, creating RedisChatMemoryRepository and MessageWindowChatMemory beans, and wiring the controller's call and stream methods to persist state.
The example runs in a standard Spring Boot app with WebFlux, and includes a TDesign chatbot UI for testing. The takeaway is that Spring AI is not a toy wrapper; it offers a cohesive way to add LLM features while staying inside the framework Java developers already know, with no separate Python service or hand-rolled HTTP client.
Modeling the client after Spring's WebClient style lowers the learning curve for Java developers already comfortable with reactive streams, making AI features feel like a natural extension of the framework.
Even with Spring AI, conversation state remains the developer's responsibility; the controller manually calls add and get, so the framework provides storage but not magic persistence.
Using an OpenAI-compatible base-url for DeepSeek shows how easy model vendor swapping becomes, but it also means vendor-specific features may be hidden behind the compatibility layer.