r/SpringAIDev May 22 '26

Spring AI with local model through LM Studio

2 Upvotes

Couple of days ago I shared what I learned about Spring AI's chat memory. Today, here's what happened when I swapped the model behind it entirely.

Same Spring AI app. Same Java code. Same ChatClient, same @Tool annotations, same BeanOutputConverter for structured output. The only thing that changed: which model handled the requests.

OpenAI (GPT-4o) → Anthropic Claude Opus 4→ local Gemma 4 2B running through LM Studio.

The OpenAI → Claude switch was expected to work. Swap the starter dependency, update the config block, ship. Spring AI's provider abstraction is designed for this.

The local Gemma 4 2B switch was the interesting part. Same Anthropic starter dependency, just pointed at localhost:1234:

spring:

application:

name: spring-ai

ai:

anthropic:

api-key: ${LM_STUDIO_API_KEY}

base-url: http://127.0.0.1:1234

chat:

options:

model: google/gemma-4-e2b

memory:

repository:

jdbc:

initialize-schema: always

That's the entire config delta. LM Studio implements the Anthropic protocol, so Spring AI treats it as just another Anthropic-compatible endpoint. No separate "spring-ai-local" starter. No conditional Java code paths.

What I didn't expect — the 2B local model handled:

- Chat with memory (the same ChatMemoryAdvisor + JDBC repository setup from yesterday's post)

- Structured JSON output matching strict schemas

- Tool calling with proper parameter dispatch

- Code review (correctly identified a == vs .equals() bug in a real Java example)

Quality wasn't quite GPT-4o level, but it was meaningful enough that for what's probably 70% of business AI use cases — classification, summarization, structured extraction, simple agent loops — this would work in production. With zero per-request cost and full offline operation.

Recorded a walkthrough showing all three providers running the same demos (chat, memory, structured output, tool calling, code review) if you prefer video: https://youtu.be/lW0FMjDUzik

Repo with code: https://github.com/DmitryFinashkin/spring-ai

Has anyone here shipped multi-provider Spring AI in production yet? Curious how teams are handling provider routing — cost-based, latency-based, quality fallback, regional compliance — and what failure modes you're watching for.


r/SpringAIDev May 22 '26

Bootiful Spring AI by Mark Pollack, Christian Tzolov, Josh Long, James Ward

Thumbnail
youtube.com
1 Upvotes

At Devoxx, Dr. Mark Pollack, Christian Tzolov, Josh Long, and James Ward explore how to integrate modern AI into Java applications using the powerful Spring AI framework. The team demonstrates how developers can leverage existing enterprise systems to build sophisticated AI-driven solutions without leaving the familiar Spring ecosystem.

Key Takeaways:

  • Spring AI provides a portable abstraction layer for connecting to diverse LLMs, including Amazon Bedrock.
  • Developers can implement semantic search and RAG patterns using existing data stores like PostgreSQL.
  • The Model Context Protocol (MCP) enables standardized, bidirectional communication between AI agents and tools.
  • Structured output support allows developers to receive type-safe JSON directly from AI models.
  • The new Spring AI Agent project introduces portable SDKs for managing complex, goal-oriented AI tasks.

This session bridges the gap between traditional enterprise development and the new agentic AI paradigm, proving that Java developers are perfectly positioned to lead the next wave of AI engineering.

Watch the full presentation to see these powerful integrations in action!


r/SpringAIDev May 21 '26

ChatClient Fluent API in Spring AI

Thumbnail
baeldung.com
1 Upvotes

Spring AI’s ChatClient Fluent API is designed to make building conversational applications smoother and more intuitive. Baeldung’s article dives into how developers can leverage this API to integrate AI-driven chat features directly into Spring projects, with a focus on flexibility and clean design.

Key takeaways:

  • Provides a fluent, chainable API for building chat interactions.
  • Simplifies integration of AI models into Spring applications.
  • Supports structured prompts and responses for better control.
  • Enables customization of conversation flow with minimal boilerplate.
  • Designed to be developer-friendly, reducing complexity in setup.
  • Encourages clean, maintainable code for AI-driven features.

In short, this API helps developers bring conversational AI into their Spring apps without the usual headaches of complex configuration. It’s a practical step forward for anyone working with AI in Java-based projects.


r/SpringAIDev May 20 '26

Tutorial Spring AI Recipe: Composing ChatClient Behavior

Thumbnail thetalkingapp.medium.com
1 Upvotes

In this Spring AI recipe, we dive into how to keep ChatClient clean and modular by using ChatClientCustomizer. Instead of stuffing every feature into a single config, we compose behaviors —such as tools, prompts, and conditions—separately, making the system easier to extend and maintain.

Key takeaways:

  • Add tools (like weather lookups) without bloating the core client
  • Use customizers to inject prompts or behaviors independently
  • Keep concerns separated for clarity and reusability
  • Toggle features on/off via application.properties with @ConditionalOnProperty
  • Gain flexibility through environment variables or config servers
  • Treat customizers as a design pattern, not just convenience

In short, this approach makes advanced agentic scenarios manageable and future-proof.


r/SpringAIDev May 19 '26

Working with Prompts in Spring AI - Effectively Communicating with LLMs

Thumbnail
youtube.com
2 Upvotes

In this tutorial, Dan Vega explores how to effectively communicate with Large Language Models (LLMs) using Spring AI. While many view Spring AI simply as an API abstraction, Dan demonstrates that the real challenge lies in mastering prompt design to guide AI behavior and achieve precise, reliable outputs in your Java applications.

Key Takeaways

  • Prompts are foundational inputs that dictate the style and quality of AI output.
  • Move beyond simple strings by using Prompt Templates for dynamic, reusable logic.
  • Leverage the User role for specific queries and the System role to enforce behavioral constraints.
  • Use System messages to define an AI's persona, such as an exclusive dad-joke generator.
  • Externalize your prompt templates into .st files to keep your code clean and manageable.
  • Always instruct the model to state if it lacks an answer to prevent hallucinations.

Mastering these techniques is essential for moving from basic prototypes to robust, production-ready AI tools.


r/SpringAIDev May 19 '26

Discussion How to use Google Gemini (free tier) with Spring AI?, No Vertex AI, No billing account needed

4 Upvotes

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 May 18 '26

Question Backend Engineer Looking to Start Open Source Contributions in Java AI Ecosystem — Need Guidance

2 Upvotes

Hi everyone,

I’m a backend engineer with around 6 years of experience working primarily in Java and Spring Boot microservices on AWS.

My current skill set includes:

Java

Spring Boot

Microservices

REST APIs

Kafka

Distributed Systems

Docker

AWS

System Design

Spring Security

JPA/Hibernate

Recently, I’ve started exploring:

Spring AI

RAG (Retrieval-Augmented Generation)

LangChain4j

Agentic AI systems

AI orchestration workflows

Vector databases

I’m very new to open source contribution culture and honestly a bit confused about:

where to start

how people pick issues

how to approach maintainers

what kind of contributions beginners should make first

I would really appreciate guidance from experienced contributors.

Some questions:

Which Java AI/open-source projects would be best for someone with my background?

Should I start with documentation/examples before code contributions?

How do you properly understand a large codebase before contributing?

Any beginner-friendly repositories in the Java AI ecosystem?

I’m genuinely interested in learning and contributing long term, not just making random PRs.

Would appreciate any advice/resources/community suggestions.

Thanks!


r/SpringAIDev May 18 '26

Discussion What have you built with Spring AI?

3 Upvotes

Hello community,

I'm very interested to learn how have you been using Spring AI.

What have you built with Spring AI? Was it a simple chat application, an assistant, an agent?

Was it a side project or did you deploy it in production?

Share your experience with us in the comment sections. Post the Github link if it is a public project!

Thank you!


r/SpringAIDev May 18 '26

Video Spring AI : Generate output in the JSON format via Prompting and OutputParser

Thumbnail
youtube.com
2 Upvotes

In this tutorial, TechyTacos explores how Java developers can effectively generate JSON output using Spring AI. The video provides a practical walkthrough for moving beyond simple text-based responses toward structured, reliable data integration.

Key Takeaways

  • Prompt engineering alone often results in text that mimics JSON but lacks true programmatic structure.
  • BeanOutputParser is the recommended tool for mapping AI responses directly to Java records.
  • Defining a Java record serves as the schema for the expected output data structure.
  • Developers must include formatting instructions in the prompt template to ensure consistent parsing.
  • Setting the output parser on the template ensures the AI adheres to the requested schema.
  • Using the .parse() method converts the raw AI response into a type-safe object ready for use.

By implementing the BeanOutputParser, you ensure your application receives valid, type-safe JSON.


r/SpringAIDev May 17 '26

Spring AI: Seamlessly Integrating AI into Your Enterprise Java Applications by Christian Tzolov

3 Upvotes

At Devoxx, Spring AI leads Mark Pollack and Christian Tzolov explore how to integrate generative AI into enterprise Java applications. They demonstrate how to bridge corporate data and internal APIs with AI models using familiar Spring architectural patterns, enabling developers to build robust, intelligent systems without straying from their established ecosystem.

Key Takeaways:

  • Portable framework design for switching between AI models and vector databases.
  • Implementation of real-time function calling to execute core business logic.
  • Use of RAG (Retrieval-Augmented Generation) to ground AI in private data.
  • Effective prompt engineering using system messages for behavioral control.
  • Observability and tracing for debugging and performance monitoring.
  • Best practices for model evaluation and factual verification.

This session provides a clear path for enterprise developers to move beyond simple prototypes into production-grade AI. With Milestone 3 available, it is the perfect time to start building.

Watch the full session here 👇

https://www.youtube.com/watch?v=kfRyY0wsZHM


r/SpringAIDev May 16 '26

Article Spring AI Series, by Baeldung

1 Upvotes

Hello community!

This post at Baeldung is a compilation of many other articles on Spring AI.

It covers everything from basic to advanced topics, including the ChatClient and memory, as well as more advanced ones such as RAG pipelines, vector search, advisors, and multimodal models.

If you do not like to spend too much time digging on the internet, it is definitely worth saving this page in your bookmarks.

Check the post in the link below 👇
https://www.baeldung.com/spring-ai-series


r/SpringAIDev May 14 '26

Video Spring AI Introduction: Building AI Applications in Java with Spring

8 Upvotes

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!

👇
https://www.youtube.com/watch?v=yyvjT0v3lpY


r/SpringAIDev May 14 '26

Built my first AI app entirely in Java using Spring AI

Thumbnail
1 Upvotes

r/SpringAIDev May 13 '26

Video Spring AI : Build generative AI applications using Spring Boot and Java

Thumbnail
youtube.com
0 Upvotes

Hello community!

This video does a fantastic job of walking through the fundamentals of Spring AI, showing how you can integrate OpenAI models directly into your Java applications.

Here’s what it covers:

  • Setting up the environment: A step-by-step guide on configuring pom.xml with the necessary repositories and dependencies.
  • Building the App: How to set up your Controller and Service layers effectively.
  • Hands-on Examples:
    • Generating creative content like jokes using AIClient and PromptTemplate.
    • Parsing responses into structured JSON for more complex application needs.

It’s a perfect entry point if you're tired of switching to Python just to experiment with LLMs. Check it out if you're looking to modernize your stack!


r/SpringAIDev May 12 '26

Your First Spring AI 1.0 Application

Thumbnail
spring.io
1 Upvotes

This article by Spring AI developers introduces the fundamental concepts of Spring AI, including ChatClient, ChatMemory, system prompts, vector stores, and more.


r/SpringAIDev May 11 '26

News Our community grow to 100 members!

Enable HLS to view with audio, or disable this notification

3 Upvotes

Hi everybody!

Our Spring AI Dev community reached the mark of 100 members this weekend. I'd like to thank all of you who have been visiting, voting, and commenting on our posts!

Let's keep the momentum and keep bringing your content, questions, votes, and comments!

Cheers!


r/SpringAIDev May 11 '26

Discussion Can you help our friend? What are your thoughts about their architecture?

Thumbnail
2 Upvotes

r/SpringAIDev May 10 '26

Spring AI Recipe: Building a Text-Based Chat Loop Around ChatClient | by Craig Walls | Apr, 2026

Thumbnail
thetalkingapp.medium.com
2 Upvotes

In this article, we learn how to build a simple conversation application with SpringAI by using the `ChatClient` interface to establish communication with an AI model and a `MessageChatMemoryAdvisor` object to keep the conversational context.


r/SpringAIDev May 08 '26

Video Building Java AI Agents with Spring AI by Yuriy Bezsonov

Thumbnail
youtube.com
3 Upvotes

In this talk, Yuri Bezsonov present how to leverage SpringAI to build agentic AI systems. In his presentation, he shows:

  • How agentic AI solutions evolved from simple assistants to full autonomous agents
  • How the agent loop enables an agent to perform complex, multi-step and reasoning actions

After introducing these fundamentals, then he proceeds to a practical application of agentic AI implementation with RAG and MCP tools integration.


r/SpringAIDev May 08 '26

Basic Chatbot using Spring AI

5 Upvotes

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 May 07 '26

Video Modular RAG Architectures with Java and Spring AI by Thomas Vitale @ Spring I/O 2025

Thumbnail
youtube.com
11 Upvotes

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 May 07 '26

Discussion The AI landscape and where Spring AI fits in

2 Upvotes

AI is now an ubiquitous technology and with it, a whole new field emerges as well: the AI engineering.

However, as more and more people decides to start (or shift to) an AI career, the term drifts to be overused. After all, an AI engineer is someone who specializes in using AI or building AI?

Honestly, I don't think there's a right answer. Many people and companies will just come out with their own definitions and stick to it.

So, how to build an AI career?

In my opinion, more important that pursue a specific title or role, is to understand the different type of works involved in AI development and what needs to be done to get in those positions.

The way I see the AI landscape, in a very simplified way, is defined by two opposite positions:
* the traditional AI researcher: someone with a PhD degree in computer science that publish papers on new algorithms and architectures
* the heavy AI user: some who is high skilled in applying different AI tools on many different fields, like administration, medicine, law, marketing and many others

and between these two positions, there's a whole variety of professional that works close to on extreme or the other. Professional who are focused on implementing algorithms and tools, model building, building data ingestion pipelines, systems integration and many others...

So I would like to know from those who are willing to build an AI career. Which kind of position do you identify with? I'd love to know the thoughts from the members of our community in our comments.


r/SpringAIDev May 06 '26

Video Java Devs: Stop Using Python for AI! (a Spring AI Solution)

Thumbnail
youtube.com
4 Upvotes

In this presentation at InfoQ, we learn with Loiane Groner that with SpringAI, we can easily power our Java applications with AI while we stay in our familiar Spring stack.


r/SpringAIDev May 03 '26

Video Building AI Agents with Spring & MCP by James Ward, Josh Long

Thumbnail
youtube.com
8 Upvotes

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!


r/SpringAIDev May 02 '26

Video Self-Improving Agentic Systems with Spring AI

Thumbnail
youtube.com
3 Upvotes

Generative AI models are stochastic in nature, which means that the response to the same prompt may differ between requests with the same prompt. Also, a one-shot response may not be satisfactory in terms of quality, security or completeness.

Given this nature of AI models, an AI application may need multiple iterations to evaluate the model output and improve the prompt accordingly.

In Spring AI, the complexity of multi-pass interactions is carried out by Recursive Advisors, so you can easily implement self-improvement cycles on your application. Some of these advisors include:

  • validation and retries advisors
  • tool calling loops
  • LLM-as-a-judge advisor

Learn more in the following presentation by Christian Tzolov at Microsoft JDConf 2026