Preface: the part you’ll skip but shouldn’t
- Who this is for
- How the book is built
- Two ground rules
Part I — Foundations
Chapter 1: Why “Spring Boot + AI,” and why now?
- What an LLM is, in one breath
- Why Java developers specifically should care
- Where Spring AI fits
- The thing we’re building toward
Chapter 2: Spring Boot basics, recalibrated for AI
- The 90-second refresher
- What’s genuinely different about AI apps
- A configuration sketch we’ll grow into
Chapter 3: AI and LLM concepts for Java developers
- The mental model: an LLM is a stateless function
- The five words you need
- The tasks you’ll actually build
- How these map to Spring AI
Chapter 4: Getting started with Spring AI
- What Spring AI is trying to be
- Bootstrapping with Spring Initializr
- Configuration
- “Hello, LLM”
Part II — Core Spring AI patterns
Chapter 5: Chat and completion APIs
- The message roles, briefly
- A chat service worth keeping
- Streaming, finally
Chapter 6: Prompt engineering and templates
- The anatomy of a good system prompt
- Don’t build prompts with string concatenation
- Three patterns that punch above their weight
Chapter 7: Structured outputs and calling into Java code
- From prose to POJOs
- Designing DTOs for extraction
Chapter 8: Embeddings and vector stores
- What an embedding actually is
- Vector stores: a database that searches by meaning
- Ingest, store, search
Chapter 9: Retrieval-Augmented Generation (RAG)
- The RAG loop
- The three things that make or break a RAG system
Part III — Building real applications and going to production
Chapter 10: Building a complete AI-powered feature
- The use case, stated like a ticket
- Clean architecture, AI edition
- The assembled service
- The controller
Chapter 11: Multi-provider and model portability
- Swapping providers is (mostly) a config change
- Fallback strategies
Chapter 12: Observability and monitoring for AI calls
- What you need to see
- Turn on Actuator and metrics
- Logging prompts and responses — carefully
- A practical logging interceptor
Chapter 13: Testing AI-powered services
- Layer 1: test your integration code, not the model (mock it)
- Layer 2: contract tests for structured outputs
- Layer 3: the fuzzy stuff — evaluating actual model behavior
Chapter 14: Security, safety, and responsible use
- Secrets: the unglamorous foundation
- Rate limiting and input validation
- Prompt injection: the new SQL injection
- Moderation and content filters
Chapter 15: Deploying Spring Boot AI apps
- Packaging with Docker
- Resource limits and timeouts
- Outbound calls: proxies, retries, circuit breakers
- Where to deploy
Part IV — Advanced topics and future directions
Chapter 16: Agents and tool-using workflows
- Agent vs. plain tool calling
- Building tools for an agent
- Modular RAG, while we’re here
Chapter 17: Complex data pipelines and document ingestion
- The ingestion pipeline: read, split, embed, store
- Scheduling ingestion
- The hard part: updates, deletes, and re-embedding
Chapter 18: Patterns, pitfalls, and “smells” in AI apps
- Smell 1: Over-reliance on brittle prompts
- Smell 2: Heavy coupling to one model or provider
- Smell 3: Latency, cost, and fallback blindness
- Smell 4: Trusting the model’s output unconditionally
- Smell 5: Reaching for complexity you don’t need
- A production-readiness checklist
Chapter 19: Where to go next
- The map you now hold
- Where to keep learning
- Extending the patterns to your own domains
- Your move
- Appendix: a one-page cheat sheet