Small, runnable Spring AI 2.0.0 examples for enterprise Java / Spring Boot teams — one module per episode of the Spring AI for Enterprise Java video series.
Each module is a self-contained Spring Boot app you can run on its own. This is a learning companion, not a framework — no shared abstractions, no magic. Read the code, run it, adapt it.
- Watch: @TheStackUnderflow
- Read: thestackunderflow.com/tutorials
| Tool | Version | Why |
|---|---|---|
| JDK | 21+ | Spring AI 2.0.0 → Spring Boot 4.0 → Spring Framework 7.0 requires Java 21 to build. |
| Gradle | (wrapper included) | ./gradlew — no local Gradle install needed. |
| API key | OpenAI (and/or Anthropic) | Set via env — see .env.example. |
git clone https://github.com/thestackunderflow/spring-ai-enterprise-examples.git
cd spring-ai-enterprise-examples
cp .env.example .env # then put your real key in .env (git-ignored)
export OPENAI_API_KEY=sk-... # or load .env however you like
# Run one episode's example:
./gradlew :01-what-is-spring-ai:bootRunNever commit a real key.
.envis git-ignored; the examples read keys from environment variables only.application.propertiesuses${OPENAI_API_KEY:}so the app starts (for tests) even without one.
| # | Module | Concept | Video |
|---|---|---|---|
| 01 | 01-what-is-spring-ai |
ChatClient in ~10 lines; the enterprise seam | (link on publish) |
| 02 | 02-why-spring-boot-teams |
DI, starters, auto-config — the patterns that transfer | soon |
| 03 | 03-chatclient-explained |
The fluent chain + reading token usage / metadata | soon |
| 04 | 04-model-portability |
One API, swappable providers (OpenAI · Anthropic · Ollama) | soon |
| 05 | 05-structured-output |
.entity() — AI text → typed Java records |
soon |
| 06 | 06-rag-vector-stores |
RAG: docs → embeddings → vector store → grounded answer | soon |
| 07 | 07-tool-calling |
@Tool — the model calls your Java services |
soon |
| 08 | 08-mcp-integration |
MCP client + server (the standard tool port) | soon |
| 09 | 09-observability |
Traces, metrics, token/latency for every model call | soon |
| 10 | 10-evaluation-guardrails |
RelevancyEvaluator — test AI output like code |
soon |
| 11 | 11-security-compliance |
Secrets, boundaries, SafeGuardAdvisor, audit |
soon |
| 12 | 12-production-blueprint |
Everything wired together, end to end | soon |
Modules land as each episode ships; folders for upcoming ones hold a short README until then.
Pinned to Spring AI 2.0.0 (see build.gradle.kts). When Spring AI releases a new
version, examples are updated alongside a "What changed" video — subscribe
to catch those.
Apache-2.0. Examples are original, written against the Spring AI 2.0.0 reference docs; the concepts are inspired by Ken Kousen's Apache-2.0 Spring AI Training Course.