// The AI will automatically call this Java function when needed. Spring AI auto-instruments all AI calls. Add micrometer-tracing-bridge-otel to your pom.xml , and you get a Grafana dashboard showing token usage, latency, and cost per request. This is critical for "in production" vs. "in action." Part 7: Where to Find the Best "Spring AI in Action" Resources (Sept 2025) Given the rapid evolution, use this matrix to find exactly what you need:
The landscape of enterprise Java development is shifting. For years, Spring Framework has been the undisputed king of dependency injection, web MVC, and data access. But 2023 and 2024 brought a tidal wave of Generative AI—Large Language Models (LLMs) like GPT-4, Gemini, and Llama. The question on every Spring developer’s lips became: How do I integrate AI into my existing Spring Boot applications without rewriting everything from scratch?
| Your Goal | Best Resource (Search term) | Format | | :--- | :--- | :--- | | | spring-ai-reference.pdf | PDF (Generated from docs) | | Copy-paste RAG code | github.com/spring-projects/spring-ai/blob/main/models/spring-ai-openai/src/test | GitHub Source | | Troubleshooting prompts | github.com/rd-1-2025/spring-ai-workshop | GitHub (Workshop) | | Production deployment | spring-ai-kubernetes-example by dashaun | GitHub Repo | | Cheat sheet | spring-ai-cheatsheet.pdf (gist.github.com) | PDF (1 page) | spring ai in action pdf github
public String ask(String question) // 1. Find relevant PDF chunks List<Document> relevantDocs = vectorStore.similaritySearch(question); // 2. Create the system prompt with context var systemPrompt = """ You are a helpful assistant. Answer using only the provided context. Context: %s """.formatted(relevantDocs.toString()); // 3. The "In Action" call return chatClient.prompt() .system(systemPrompt) .user(question) .call() .content();
If you are searching for , you aren't just looking for documentation. You want a tactical, hands-on resource . You want code you can clone, run, and modify. You want examples of chat clients, RAG (Retrieval-Augmented Generation), and function calling. // The AI will automatically call this Java
Enter . This new addition to the Spring ecosystem provides an abstraction layer for AI models, similar to how Spring Data abstracts databases.
@Service public class ChatWithPdfService private final ChatClient chatClient; private final VectorStore vectorStore; // Constructor injection omitted for brevity This is critical for "in production" vs
@Bean public Function<WeatherRequest, WeatherResponse> currentWeather() return (request) -> weatherService.getTemp(request.city);