Udemy
Turn what you know into an opportunity and reach millions around the world.
Learn More
Your cart is empty.
Keep shopping
Spring AI with Java: RAG, Tools, Agents and MCP & Thymeleaf
New

Spring AI with Java: RAG, Tools, Agents and MCP & Thymeleaf

Build a TrainingHub assistant with local LLMs, PostgreSQL, pgvector, RAG, MCP, testing, Thymeleaf and human approval
Last updated 12/2026
English

What you'll learn

  • Build a Spring Boot application that sends prompts to a local language model using Spring AI ChatClient.
  • Implement retrieval-augmented generation with embeddings, PostgreSQL and pgvector, and evaluate answers against sources.
  • Connect Java tools and MCP clients and servers, and inspect how model requests become tool calls and results.
  • Test and observe an AI application, and implement approval before changing data in PostgreSQL.
  • Connect a Thymeleaf interface to an existing Spring AI application and follow conversations, source-backed answers and a human-approved schedule change.

Course content

10 sections • 58 lectures • 8h 12m total length
  • Course Introduction: Build an AI Assistant2:49
  • What You Will Build4:13
  • Set Up Your Windows Development Environment3:11
  • Follow an LLM Request Through Spring Boot7:16
  • Run the TrainingHub Starter6:07
  • Connect Your First Model with ChatClient8:15
  • Inspect a Response and Diagnose Startup Errors6:23
  • Module 1 Quiz: Spring AI Foundations

Requirements

  • Basic Java, Spring Boot and REST knowledge; a computer able to run JDK 21, IntelliJ IDEA, Docker and a local model.

Description

Build a Java assistant that can look up current course information, answer questions using policy documents, and propose a schedule change for a person to approve. In this course, you will follow TrainingHub, a Spring application that connects language models to real application code and data.


The course starts with a local model and Spring AI ChatClient. You will follow requests and responses in IntelliJ IDEA, then explore prompts, structured responses, streaming and conversation memory. Along the way, you will see how the application associates a conversation with a user and why that boundary matters.


Next, follow a tool call from start to finish. See how a model proposes a tool and its arguments, how Java executes the method, and how its result returns to the model. Connect tools to business data and inspect what happens with invalid input, missing records and access restrictions.


For document question answering, work through a retrieval-augmented generation (RAG) flow. Split policy documents into fragments, create embeddings and search PostgreSQL with pgvector. A dedicated lesson introduces Spring AI's PgVectorStore. Examine the retrieved sources, build answers from available evidence, and consider cases where the evidence or the model's answer is insufficient.


You will then move from reading information to proposing an action. In the TrainingHub rescheduling workflow, the model suggests a date and application code validates a pending proposal. Explore authorization, rejection, transactions, stale data, repeat approval and expiry. A separate approval step controls when an authorized change is applied to PostgreSQL.


The course also introduces MCP from both sides: expose a schedule tool in a server, discover it with a Spring client and follow its use by an assistant. Test selected tool contracts, session boundaries, approval rules and MCP behavior without relying on a live model for every test. Evaluate retrieval separately from generated answers, run a live-model smoke test, and inspect latency, token information, timeouts, rate limits and retry behavior.


Build a simple TrainingHub browser interface with Spring MVC, Thymeleaf, HTML, CSS and JavaScript. Connect a conversation form to the existing API, display RAG answers with their supporting sources, and review a proposed schedule change before an authorized approver applies it.




Finally, work with an integrated TrainingHub example that brings RAG, MCP and human approval together. The course includes demonstrations, downloadable project archives, exercises and observed application outputs. The examples are teaching systems: model results can vary, and security and reliability need further design and review before production use.


The walkthroughs use Windows and PowerShell, Java 21, Maven, IntelliJ IDEA, Docker Compose, PostgreSQL, pgvector and local Ollama models. Downloads require network access and available disk space. The English narration uses an AI-generated voice.


This course contains the use of artificial intelligence.

Who this course is for:

  • Java and Spring Boot developers who want to build practical AI-enabled applications and learn RAG, tools and MCP.