Why a Shirt Recommender Is a Good First Spring AI Project
Most tutorials that introduce large language models to Java developers start with a chatbot that answers questions. That is a useful starting point, but it hides the part that makes LLM features valuable inside a real application: the model has to take an action that your code controls. A chatbot that only produces text is a demo. An agent that looks something up in your own system and returns a structured result is a feature.
This article walks through shirts-agent , a small Spring Boot and Spring AI example that makes the idea concrete. A user sends an item and a color to a REST endpoint. An AI agent calls a Java method that searches an in-memory catalog, and the service returns a structured shirt recommendation. The whole project fits in a few classes, which makes it a good way to see how the pieces fit together before you build something larger.
The project uses Java 21, Spring Boot 3.5.6, Spring AI 1.1.8, OpenAI's gpt-4o-mini model, and Maven.…