Spring Boot’s convention-over-configuration model is genuinely one of the best things to happen to Java productivity — and also the source of the most confusing production bugs I have debugged. Autoconfiguration fires conditions you never set consciously. Security filters block requests for reasons that aren’t logged. Default settings that are fine for development (open-in-view=true, 10-connection HikariCP pool, permissive CORS) quietly create problems at scale.
I built this prompt set specifically for gaps I kept hitting when using AI assistants for Spring Boot work. Generic prompts produce boilerplate that compiles but ignores your Spring Boot version, your actual security requirements, and the performance implications of the defaults chosen. These 10 prompts are engineered around context: they ask you to provide your Spring Boot version, your business rules, and your actual failure scenario, so the AI produces output you can actually commit. Tested against Claude Sonnet 4 and GPT-4o with Spring Boot 3.4 and Spring Security 7.
This post gives you 10 copy-paste AI prompts for Spring Boot development, covering the full lifecycle from initial scaffolding to production hardening and version migration. Each prompt is engineered to give the AI enough context to produce immediately usable, production-quality output.
For background on the Spring ecosystem, see the Java category. For complementary testing prompts, see 10 AI Prompts to Generate JUnit 6 Tests for New Projects.
Tag Archives: Spring Boot
Spring Boot — convention-over-configuration framework for building Spring-based Java applications
Spring Data JPA: Complete Guide — Repositories, Queries, and Projections
Spring Data JPA eliminates the EntityManager boilerplate that used to fill every data-access class — you describe the query in a method name or a @Query annotation, Spring generates the implementation at startup. In practice it is both simpler than writing raw JDBC and more dangerous than it looks, because the abstractions hide decisions that have real performance consequences.
I have spent four years working with Spring Data JPA across teams of varying sizes — from small startups running H2 in development to larger orgs running Hibernate 6.4 against PostgreSQL under sustained load. The N+1 queries, the LazyInitializationException stack traces, the open-session-in-view debates — I have lived all of them. This guide covers every technique you will encounter in a production Spring Boot application, with honest notes on where each approach breaks down. Tested on Spring Boot 3.4.1, Hibernate 6.4, Spring Data JPA 3.4, Java 21, PostgreSQL 16.
LLM Gateway for Java Microservices — Complete Runnable Code & Demo
This is the companion code post to ← The LLM Gateway Pattern for Java Microservices. That article explains the design decisions behind each layer. This post gives you the complete project — every file, ready to clone and run.
Prerequisites
- Java 21+ and Maven 3.9+
- Docker and Docker Compose (for Redis)
- An OpenAI API key — required. Anthropic and Ollama keys are optional; the gateway falls back automatically if they are absent.
Project Structure
llm-gateway/
├── docker-compose.yml
├── pom.xml
└── src/main/
├── java/com/example/gateway/
│ ├── LlmGatewayApplication.java
│ ├── cache/
│ │ ├── CacheEntry.java
│ │ └── SemanticCache.java
│ ├── controller/
│ │ └── LlmGatewayController.java
│ ├── cost/
│ │ └── CostTracker.java
│ ├── model/
│ │ ├── LlmGatewayRequest.java
│ │ └── LlmGatewayResponse.java
│ ├── orchestrator/
│ │ ├── LlmGatewayOrchestrator.java
│ │ └── RateLimitExceededException.java
│ ├── ratelimit/
│ │ ├── TenantTier.java
│ │ ├── TenantTierRepository.java
│ │ └── TokenBudgetRateLimiter.java
│ └── registry/
│ ├── AllProvidersUnavailableException.java
│ ├── LlmProviderRegistry.java
│ └── ResilientProviderCaller.java
└── resources/
└── application.yml
Spring AI RAG in Java — Complete Runnable Code & End-to-End Demo
This is the companion code post to ← Production-Grade RAG with Spring AI 1.1.0. That article explains how every layer works. This post gives you the complete project — every file, ready to clone and run.
Prerequisites
- Java 21+ and Maven 3.9+
- Docker and Docker Compose (for PostgreSQL + pgvector)
- An OpenAI API key (
export OPENAI_API_KEY=sk-...)
Project Structure
spring-ai-rag/
├── docker-compose.yml
├── init.sql
├── pom.xml
└── src/main/
├── java/com/example/rag/
│ ├── RagApplication.java
│ ├── config/
│ │ └── RagConfig.java
│ ├── controller/
│ │ └── RagController.java
│ ├── ingestion/
│ │ ├── DocumentIngestionService.java
│ │ ├── IngestionException.java
│ │ └── IngestionTracker.java
│ ├── model/
│ │ ├── FaithfulnessResult.java
│ │ ├── IngestionResult.java
│ │ ├── QueryRequest.java
│ │ ├── RagQueryOptions.java
│ │ ├── RagResponse.java
│ │ ├── ScoredDocument.java
│ │ └── SourceAttribution.java
│ └── query/
│ ├── CrossEncoderReranker.java
│ ├── HallucinationGuard.java
│ └── RagQueryService.java
└── resources/
└── application.yml
The LLM Gateway Pattern for Java Microservices: Multi-Provider Failover, Cost Control, and Rate Limiting
Every Java team building AI features eventually faces the same set of problems: a single LLM provider goes down during a critical demo, a runaway loop burns $500 of API credit overnight, or two product teams independently hard-code OpenAI keys into separate microservices and you lose all cost visibility. The LLM Gateway pattern solves all of these — and it’s the most underbuilt component in the Java AI ecosystem today. This post walks through designing and implementing a production-grade LLM Gateway in Spring Boot: multi-provider routing with automatic failover, circuit breaking, rate limiting, cost tracking, semantic caching, and tenant isolation.
Continue reading The LLM Gateway Pattern for Java Microservices: Multi-Provider Failover, Cost Control, and Rate LimitingProduction-Grade RAG with Spring AI 1.0 in Java: Chunking, Reranking, and Hallucination Guards
Most RAG tutorials stop at “load a PDF, embed it, ask a question.” That works in a demo. In production — handling 10 000 documents, diverse query types, and user expectations of factual accuracy — it falls apart within weeks. This guide walks through every layer of a production-grade Retrieval-Augmented Generation (RAG) system built entirely in Java using Spring AI 1.1.0: from chunking strategy selection and vector store tuning to reranking, hallucination guards, cost tracking, and observability.
Continue reading Production-Grade RAG with Spring AI 1.0 in Java: Chunking, Reranking, and Hallucination GuardsJava 21 to Java 25 Upgrade Guide (with AI Prompts)
Java 25 shipped as an LTS release in September 2025. If you are already on Java 21 LTS, the jump is mostly smooth — most new features were previews in 21 that are now final — but there are a handful of deprecations, build-tool bumps, and behavioural tweaks that will trip you up if you do not prepare. This guide walks through the upgrade end-to-end with a migration checklist and AI prompts to automate the tedious parts.
Continue reading Java 21 to Java 25 Upgrade Guide (with AI Prompts)