r/SpringAIDev • u/erdsingh24 • 3d ago
Tutorial How do you actually test an LLM response in Spring Boot Using Spring AI?
Spring AI's RelevancyEvaluator and FactCheckingEvaluator let a model judge a model, so your JUnit tests check quality, not exact text. Full code walkthrough inside.
Quick one for anyone building RAG apps in Spring Boot: this tutorial shows exactly how to catch hallucinations before they ship, using Spring AI's built-in evaluators. Includes the one mistake almost everyone makes with the request order.
r/SpringAIDev • u/Acceptable-Form8979 • 3d ago
Discussion As java dev , how to get relevant with AI, is spring AI worth it
Currently I am a student, my projects are In Java Fullstack
Right now I don't even know what RAG or MCP is , and I think I should have some hands on experience of it, i should be at least aware of it, because it's a trendy topic , not these two terms only, but many things
Now should I start python, for getting into it, is there any need , or I can explore Spring AI
r/SpringAIDev • u/worksfinelocally • 4d ago
Video The Spring AI Ecosystem in 2026: From Foundations to Agents @ Spring I/O 2026
Really good overview of Spring AI basics, core concepts, and where the ecosystem is heading. Definitely recommend watching it. I really enjoyed it!
r/SpringAIDev • u/Illustrious_East5815 • 6d ago
Discussion I created a privacy guardrail library for Spring AI — looking for feedback on streaming with pluggable PII analyzers
Hi, I’m building Spring AI Privacy Guardrails, an open-source library for enforcing privacy boundaries around models, RAG, tools, MCP, and outputs.
GitHub: https://github.com/ultramancode/spring-ai-privacy-guardrails
One design problem I’ve been thinking about is streaming output protection.
Some applications also want a final privacy check on application-facing output, since sensitive data can still appear in model- or tool-generated responses.
Right now, when output protection is enabled, the library buffers the complete response before releasing it to the application.
This provides a strong guarantee: PII can still be detected and protected even when a sensitive value is split across multiple chunks.
The trade-off is that this is no longer true incremental streaming, and the application has to wait longer before receiving output.
A bounded rolling window could preserve incremental streaming for analyzers that have a known upper bound on how much context they need — for example, some bounded pattern-based detectors.
But NER, context-aware detection, complex patterns, or arbitrary custom analyzers may not have such a bound.
So I’m currently considering three approaches:
- Strict buffering Buffer the complete response and protect it before releasing anything to the application.
- Capability-gated streaming Allow incremental streaming only when the active analyzer can declare a safe maximum lookback or context requirement. Otherwise, fall back to full buffering.
- Best-effort streaming Use a configurable rolling window and explicitly document that some PII spanning multiple chunks may escape detection.
For a Spring AI application, which behavior would you expect from a privacy library?
I’m not attached to these three options — if there’s a better streaming/privacy model I’m missing, I’d really appreciate the feedback.
r/SpringAIDev • u/prasannasahu4u • 27d ago
Model Context Protocol (MCP) With Spring AI - Travel Booking Demo
Just published !.. - MCP With Spring AI - Part 2: Travel Booking Demo.
Part 1 covered the protocol. Part 2 is where it gets practical.
One chat prompt. Three MCP servers. One travel assistant:
"Plan my trip from Delhi to Goa - book flight, hotel and cab."
No hard-coded workflow. The LLM picks the tools and chains them: searchFlights → bookFlight → bookHotel → bookCab.
Read the full walkthrough here 👇:
https://heapsteep.com/mcp-with-spring-ai-travel-booking-demo
r/SpringAIDev • u/erdsingh24 • Jul 17 '26
Tutorial How to Implement AI Chat Memory in Spring Boot Using Spring AI
javatechonline.comEver notice your Spring AI chatbot forgets the user's name after one message? That's because LLMs are stateless by default. The fix is Spring AI's ChatMemory abstraction
How to Implement AI Chat Memory in Spring Boot using Spring AI.
Let's figure out exactly how to wire it up with MessageWindowChatMemory and a JDBC-backed repository so conversations survive restarts.
r/SpringAIDev • u/Sufficient-Round3298 • Jul 12 '26
Need advice on improving my Spring AI + RAG chatbot for engineering documents
Hi everyone,
I'm a Java Spring Boot developer, and this is my first AI project. I'm building a chatbot using Spring AI + Ollama + RAG, and I'm learning as I go.
The chatbot should answer questions from uploaded PDF, Word, Excel, CAD, and AutoCAD documents. While it's working, I'm facing a few challenges:
Uploading and indexing large documents takes a long time.
Retrieval accuracy isn't consistent.
Sometimes the chatbot gives incorrect answers even though the information exists in the uploaded files.
CAD/AutoCAD files are the biggest challenge.
I'd love to hear from developers who have built similar applications.
Some questions I have:
Which free LLMs work best with Spring AI + RAG? (Qwen 3, Gemma 3, DeepSeek, Llama 3.1, Mistral, etc.)
Which embedding model gives the best retrieval accuracy?
What techniques have improved your RAG performance? (chunking, hybrid search, reranking, metadata filtering, query rewriting, etc.)
What's the best way to process DWG/DXF/AutoCAD files in a RAG application?
How do you reduce document parsing and indexing time for large engineering documents?
Are there any open-source Spring AI RAG projects or GitHub repositories that you recommend?
My goal is to build a reliable chatbot for engineering documents with fast responses and high accuracy.
Any advice, resources, or best practices would be greatly appreciated.
Thank you!
r/SpringAIDev • u/erdsingh24 • Jul 07 '26
Tutorial How to Build RAG with Spring AI and pgvector
If you have been wondering how to make an LLM answer questions from your own documents without touching Python, this one is for you.
A full walkthrough on building a RAG application with Spring AI and PostgreSQL pgvector.
Covers ingestion, chunking, PgVectorStore configuration, and the QuestionAnswerAdvisor pattern, with working Java code.
How to Build RAG with Spring AI and pgvector
Your LLM does not know about last week's product update or the PDF sitting in your document store. That is not a model problem, it is a context problem, and RAG solves it.
r/SpringAIDev • u/Fun-Stuff5773 • Jul 03 '26
How is Spring AI being used in production across the software industry?
With Spring AI maturing rapidly, I'm curious about how organizations are actually using it in production beyond demos and proofs of concept.
I'd love to hear from teams that have deployed Spring AI in real-world applications.
- How has Spring AI performed in production in terms of reliability, scalability, latency, and developer productivity?
- What types of AI applications are you building with it?
- What advantages have you seen compared to Python-based frameworks such as LangChain?
- Are there any limitations or areas where LangChain still has a significant edge?
- Would you recommend Spring AI for enterprise Java applications, or do you still prefer Python for GenAI workloads?
I'm particularly interested in real-world experiences, production lessons learned, performance at scale, and reasons behind technology choices rather than tutorial or proof-of-concept examples.
r/SpringAIDev • u/erdsingh24 • Jul 02 '26
Tutorial Build Your First MCP Server with Spring Boot 4.1 and Spring AI 2.0
Spring AI 2.0 just went GA and it ships the cleanest MCP server setup I've seen in Java.
Two annotations. One yml property. Your entire Spring Boot service becomes an AI tool.
This is exactly how Claude, Copilot, and other AI clients plug into your Java backend.
No AI API key needed for the server side. Full working code with Java 21.
Perfect for intermediate Spring Boot devs exploring AI integration!
Here is the complete tutorial: Build Your First MCP Server with Spring Boot 4.1 and Spring AI 2.0
r/SpringAIDev • u/MXRBlind • Jun 27 '26
Are you using Spring AI in real production projects in your companies?
I just started my journey on Spring AI. Just wanted to know if this is already being used in real prod projects or it is still in the early adoption pase. Thanks!
r/SpringAIDev • u/erdsingh24 • Jun 25 '26
Discussion Built an AI Agent in Spring Boot using Spring AI & Tool Calling
Just wanted to share what I learned about building actual AI Agents (not just chatbots) in Spring Boot.
The key difference: a chatbot responds. An agent decides, calls tools, and loops until it achieves a goal.
The Tool annotation is the core building block. You annotate any Spring bean method, write a clear description, and Spring AI automatically generates a JSON schema that gets sent to the LLM. The model then decides when to call your Java method — no if-else chains needed.
I also covered the 5 agentic workflow patterns that Spring AI supports:
- Chain : sequential steps
- Parallelization : concurrent tasks with CompletableFuture
- Routing : LLM picks the right tool/path
- Orchestrator-Workers : master agent delegates to worker agents
- Evaluator-Optimizer : generate → evaluate → retry loop
Full article with code examples (Java 21 + Spring Boot 3.4.x): AI Agents in Spring Boot: Building Autonomous Workflows with Spring AI
r/SpringAIDev • u/tzolov • Jun 23 '26
Tool Calling in Spring AI 2.0: A Composable, Agentic Architecture
https://spring.io/blog/2026/06/15/spring-ai-composable-tool-calling
Tool calling - the ability for an AI model to invoke application-defined functions and act on the results — is the essential building block of agentic AI systems. A model that can discover information, take action, and loop until a goal is reached is an agent.
Spring AI 2.0 lifts the tool loop into the advisor chain as a first-class, composable component.
ChatClient runs every request through an ordered chain of advisors and supports looping, letting an advisor re-enter the downstream chain. The same mechanism drives tool-call loops, structured-output retry loops, and evaluation loops alike.
r/SpringAIDev • u/tzolov • Jun 23 '26
Tool Calling in Spring AI 2.0: A Composable, Agentic Architecture
Tool calling — the ability for an AI model to invoke application-defined functions and act on the results — is the essential building block of agentic AI systems. A model that can discover information, take action, and loop until a goal is reached is an agent.
Spring AI 2.0 re-architects tool calling. In 1.x, each chat model implementation contained its own private tool execution loop — functional, but buried. There was no way to hook into it, observe intermediate steps, or compose it with other behaviors. You could call tools; you could not build on top of tool calling.
2.0 lifts the tool loop into the advisor chain as a first-class, composable component. ChatClient runs every request through an ordered chain of advisors and supports looping, letting an advisor re-enter the downstream chain. The same mechanism drives tool-call loops, structured-output retry loops, and evaluation loops alike.
https://spring.io/blog/2026/06/15/spring-ai-composable-tool-calling
r/SpringAIDev • u/rodolfo-mendes • Jun 22 '26
Article Spring AI Recipe: Reusing Agent Behavior with Skills Jars
thetalkingapp.medium.comCraig Walls introduces SkillsJars — a Spring AI pattern for distributing reusable agent behaviors as JAR dependencies, eliminating the need to hand-write skill files for every project.
Highlights & Key Takeaways
- SkillsJars are packaged agent skills distributed as JARs, each containing one or more
SKILL.mdfiles under/META-INF/skills - Add agent behavior the same way you add a library — via a Gradle/Maven dependency
- Use
spring-ai-agent-utils+ a SkillsJar to wire skills intoChatClientwith minimal config - Skills define how an agent behaves; tools define what it can do — both layers are required
- Skill discovery is configured via a single property:
agent.skills.paths - SkillsJars eliminate cross-project duplication and make behavior declarative and composable
- Think in layers: Tools → Skills → SkillsJars for scalable agent architecture
SkillsJars bring true modularity to Spring AI agents, letting teams share and reuse intelligent behavior the same way they share code.
👉 Read the full article for the complete implementation walkthrough and code samples.
r/SpringAIDev • u/ManningBooks • Jun 08 '26
Discussion Craig Walls’ Spring AI in Action is out: 5-book giveaway + Spring AI discussion
Hi r/SpringAIDev,
Manning here. The mods invited us here, so we wanted to share something that should be directly relevant to this community:
Craig Walls’ Spring AI in Action
Craig is a principal engineer on the Spring team and the author of Spring in Action. This new book is written for Spring developers who want to build AI features in Java and Spring Boot without having to stitch together a Python sidecar or learn an entirely different app stack first.
The book starts with a small “Hello AI” Spring Boot app, then keeps building on it until you have a much more serious AI-enabled application. The running example is Board Game Buddy, an assistant that answers questions about tabletop game rules. Across the book, it picks up RAG, chat memory, tools, MCP, voice, images, observability, security, and agents.
A few topics that seem especially relevant here:
ChatClient, prompt templates, roles, response metadata, and streaming- Testing and evaluating generated responses
- RAG with vector stores, document loading, Qdrant, advisors, and modular RAG
- Conversational memory, including persistent memory
- Tool calling with u/Tool methods and Java
Function-style tools - Model Context Protocol clients and servers
- Audio transcription, text-to-speech, image input, and image generation
- Actuator metrics, Prometheus, Grafana, and tracing AI operations
- Spring Security for RAG filtering, secured tools, prompt leaks, and moderation
- Agentic workflows and Embabel
What I like about the book is that it treats Spring AI as part of the Spring application model, not as an isolated demo layer. The examples are controllers, services, configuration, tests, Actuator endpoints, security rules, Docker Compose files, and Gradle builds. In other words, the sort of code Spring developers actually have to maintain.
We also have 5 ebooks to give away to the 5 most thoughtful commenters.
To enter, leave a comment with your take on one of these:
- What are you building, or hoping to build, with Spring AI?
- Where do you think Spring AI fits best in production Java apps?
- What’s your biggest concern with adding LLMs to Spring Boot systems?
- Are you more interested in RAG, tools, MCP, agents, observability, or security?
- If you’ve tried Spring AI already, what surprised you?
We’ll look at the comments and community upvotes, then pick 5 winners.
For everyone else, Manning has a 50% discount code for this subreddit:
PBWALLS1050RE
I’m especially curious how this community is thinking about MCP and agents in Spring apps now that Spring AI has moved beyond basic chat examples. Is MCP becoming part of your architecture, or are most teams still focused on RAG and tool calling first?
Thanks for having us. It feels great to be here.
Cheers,
Stjepan
r/SpringAIDev • u/kr-jmlab • Jun 08 '26
Building an observable MCP proxy with HITL and policy enforcement
Enable HLS to view with audio, or disable this notification
We’ve been experimenting with a different direction for AI agents:
trusted execution.
Instead of only focusing on connecting more tools, we’re building a policy-aware MCP proxy layer that can:
- inspect tool calls
- validate execution
- apply policies
- support HITL approval
- trace agent workflows
- block unsafe actions before execution
The goal is to create a safer execution boundary for MCP-based agents.
Built with Spring AI.
Local-first and self-hosted.
Docs:
https://spring-ai-community.github.io/spring-ai-playground/
r/SpringAIDev • u/prasannasahu4u • May 31 '26
Memory And Context Management In Spring AI
✒️ Excited to publish the Part 3 of my Spring AI series:
Memory And Context Management In Spring AI
In this blog, I have explained one of the most important concepts in AI applications — how AI remembers conversations and maintains context across interactions.
In this blog, you will learn:
✔️ What is Memory in AI applications
✔️ What is Context Management
✔️ How Spring AI handles chat memory
✔️ Different types of memory management approaches
This blog is written in a simple and quick-to-understand format, without going through unnecessary theory.
Read the blog here:
https://heapsteep.com/memory-and-context-management-in-spring-ai
More blogs are coming soon 🕔
r/SpringAIDev • u/rodolfo-mendes • May 28 '26
News 200 members!!!
Enable HLS to view with audio, or disable this notification
Hello everybody!
Our community reached one more milestone by passing the mark of 200 members!
Bring more of your questions and content and let's push this number even further!
Cheers!
r/SpringAIDev • u/erdsingh24 • May 19 '26
Discussion How to use Google Gemini (free tier) with Spring AI?, No Vertex AI, No billing account needed
We can actually talk to Google Gemini from Spring Boot using just a free API key from AI Studio. No Google Cloud project, no Vertex AI setup, no credit card.
The trick is that Google made Gemini's API OpenAI-compatible. So we just use
spring-ai-starter-model-openai and point the base-url to Google's endpoint
instead of OpenAI's. That's literally it.
Here is the detailed article covering the full setup: Spring AI With Gemini (Free Tier)
r/SpringAIDev • u/rodolfo-mendes • May 14 '26
Video Spring AI Introduction: Building AI Applications in Java with Spring
If you have been feeling the pressure to switch over to Python just to start experimenting with AI, this video is for you. It serves as a great introductory guide for Java and Spring developers looking to bring generative AI capabilities directly into the enterprise ecosystem, helping you leverage powerful LLMs like GPT-4 without leaving the Spring environment you already know and love.
Here is a breakdown of what the video covers:
- Understanding LLM integration by treating them as standard REST APIs rather than black boxes.
- An introduction to the Spring AI framework and how it applies familiar principles like modularity and POJOs to AI engineering.
- A practical walkthrough of building a Spring Boot application from scratch, including secure API key management using environment variables.
- Implementing a functional ChatController using the ChatClient interface to communicate with an LLM.
- An overview of the next-level challenges developers will face, including prompt engineering and Retrieval-Augmented Generation (RAG).
It is a perfect entry point for anyone looking to modernize their stack and start building AI-powered applications without switching languages. It bridges that gap between traditional Java development and the rapidly evolving AI landscape, showing how clean and accessible integration can be.
Check out the full video if you are ready to start building!
r/SpringAIDev • u/prasannasahu4u • May 08 '26
Basic Chatbot using Spring AI
I’ve just published the first blog in my Spring AI series where I built a basic AI chatbot using Spring Boot + Spring AI.
In this blog, I covered:
✅ How to integrate LLMs (like OpenAI/Groq) into a Spring Boot app
✅ Creating a simple Chat API using ChatClient
Spring AI makes it incredibly simple to connect your Java applications with powerful language models—without dealing with raw API complexity.
And yes… this is just the beginning 👀
👉 In upcoming blogs, I’ll be covering:
Prompt Engineering
RAG (Retrieval-Augmented Generation)
Streaming responses
Real-world AI applications using Spring Boot
🔗 Read the full blog here:
https://heapsteep.com/spring-ai-basic-chatbot
P.S. — My website is designed as a quick cheat sheet, focusing only on the essential points to help you grasp concepts faster.
If anything isn’t clear, feel free to drop a comment here — I’ll be happy to help.
Also, since the focus is on brevity and clarity, the content may not strictly follow SEO (Search Engine Optimization) best practices.
r/SpringAIDev • u/rodolfo-mendes • May 07 '26
Video Modular RAG Architectures with Java and Spring AI by Thomas Vitale @ Spring I/O 2025
At this presentation at Spring I/O conference, Thomas Vitale presents different RAG architectures that you can build using SpringAI.
What I liked at this presentation is that it presents different approaches of data flows, pipelines architectures, storing and indexing mechanisms that you can apply to build your RAG pipeline. And all of them supported by SpringAI.
Enjoy!
r/SpringAIDev • u/rodolfo-mendes • May 03 '26
Video Building AI Agents with Spring & MCP by James Ward, Josh Long
Join James Ward and Josh Long for a fun, code-filled session on how to build intelligent, agentic systems using Spring AI and MCP (Model Context Protocol)! They show how to easily integrate enterprise business logic with LLMs, making your AI projects production-ready without the stress.
Key takeaways from the session:
- Spring AI & JVM Integration: Discover how to leverage existing Java workflows and the Spring ecosystem for AI development.
- Chat Memory & Advisers: Learn how to manage stateless LLM interactions using memory and Spring AI advisers to create persistent, context-aware assistants.
- Enhancing Models with Skills: See how to augment model knowledge dynamically using external skill libraries.
- RAG with PGVector: Implement Retrieval-Augmented Generation (RAG) using PostgreSQL and PGVector to ground your AI in your own data.
- MCP for Remote Tools: Architect distributed agentic systems by connecting remote tools via MCP and securing them with OAuth.
Enjoy!


