Spring Boot 3 & Java 21 Gemini System Prompt

Production-grade architectural rulebook for Spring Boot 3 & Java 21. Engineered to eliminate LLM hallucinations, enforce strict deterministic conventions, and prevent architectural drift across Cursor IDE, Claude Code CLI, and autonomous multi-agent pipelines.

Target Path
prompts/gemini-system-instructions.json
Execution Scope
Project Context
Specification Format
Markdown / Config
AI Tool Support
Universal AI Assistants
02 / DRIFT ANALYSIS & VALUE PROPOSITION

Failure Patterns Prevented for Spring Boot 3 & Java 21

Without This Rule (Default LLM Behavior)Vulnerable

Spring Boot 3 requires Java 17+ (ideally Java 21) and migrates all packages from javax.* to jakarta.*. AI models trained on legacy Java code constantly hallucinate deprecated javax.persistence imports, bulky Lombok boilerplate instead of Java Records, and legacy WebSecurityConfigurerAdapter classes.

Hallucination Symptoms
  • Invokes deprecated or removed APIs from older model training weights
  • Generates conflicting configuration files and invalid imports
  • Silently drops type-safety, boundaries, or transaction isolation
With This Rule (Guaranteed Invariants)Deterministic
Use jakarta.* packages for persistence, validation, and servlets; ban legacy javax.* imports.
Represent immutable request/response DTOs using native Java Records with Jakarta validation annotations.
Enable Java 21 Virtual Threads (spring.threads.virtual.enabled=true) for high-throughput non-blocking I/O.
Configure Spring Security using the modern SecurityFilterChain bean approach; never extend deprecated WebSecurityConfigurerAdapter.
Avoid N+1 queries in Spring Data JPA: use @EntityGraph or JOIN FETCH JPQL queries for relational fetches.
03 / VERIFIED CODE PATTERNS

Code Standards: Anti-Pattern vs Verified Implementation

Discouraged Anti-Pattern
// Discouraged: Legacy javax namespace, verbose POJO with setters, mutable entity exposure
import javax.persistence.*; // Obsolete in Spring Boot 3!

public class BadOrderDTO {
    private String customerId;
    public void setCustomerId(String id) { this.customerId = id; }
}
Verified Production Standard
package com.example.demo.order;

import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Positive;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;
import java.math.BigDecimal;

public record CreateOrderRequest(
    @NotBlank String customerId,
    @Positive BigDecimal amount
) {}

public record OrderResponse(Long id, String customerId, BigDecimal amount) {}

@RestController
@RequestMapping("/api/v1/orders")
public class OrderController {
    private final OrderService orderService;

    public OrderController(OrderService orderService) {
        this.orderService = orderService;
    }

    @PostMapping
    public ResponseEntity<OrderResponse> create(@RequestBody CreateOrderRequest request) {
        OrderResponse response = orderService.processOrder(request);
        return ResponseEntity.ok(response);
    }
}
04 / REPOSITORY PLACEMENT & 3-STEP TERMINAL INSTALLATION

How to Install Spring Boot 3 & Java 21 Gemini System Instructions via Terminal

1

Step 1: Open Project Directory & Verify Target Placement

Open your terminal and navigate to your project root folder where the prompts/gemini-system-instructions.json file will reside. Ensure the file is placed at the exact path below relative to your project root so the AI engine automatically loads it:

prompts/gemini-system-instructions.json
2

Step 2: Fetch Rule File via Terminal Command

Run curl, PowerShell, or wget to stream the rule directly from the DevScratchpad raw API endpoint and write it to prompts/gemini-system-instructions.json:

Terminal One-Liner Install

Run directly in your project root to stream and write this rule file with one command.

Raw API Stream
$mkdir -p "prompts" && curl -fsSL "https://www.devscratchpad.tech/api/raw/gemini-prompts/spring-boot-3" -o "prompts/gemini-system-instructions.json"
3

Step 3: Verify and Activate with AI Agent

Launch your AI coding assistant (Universal AI Assistants). The assistant will automatically discover prompts/gemini-system-instructions.json in your repository and apply the architectural guardrails, type constraints, and verification protocols during code generation.

05 / ROUTE DIRECTORY & CROSS-TOOLING
Format Pillar HubComprehensive Manual

Gemini API System Instructions Generator

Inspect the complete specification manual, glob patterns, directory rules, and all available presets in our central directory.

/gemini-prompts Directory
06 / RECOMMENDED OFFLINE DEVELOPER TOOLS

Pair With Spring Boot 3 & Java 21 Client-Side Utilities

100% private, browser-based utilities to test, format, and inspect code generated by your AI rules.

View All 28 Tools

Migrating from Legacy .cursorrules or CLAUDE.md?

Use our free, offline converter to transform monolithic rulebooks into modular Cursor .mdc, Claude SKILL.md, and Windsurf Cascade rules.

Convert Rules Free →
07 / FREQUENTLY ASKED QUESTIONS

Technical FAQ: Spring Boot 3 & Java 21 AI Rulebooks

Does this rulebook support Java 21 virtual threads?

Yes, it guides configuration and usage of lightweight virtual threads (Project Loom) for high-concurrency Spring Boot 3 services.

Why does it ban javax.* packages?

Spring Boot 3 requires Jakarta EE 10 APIs; javax.persistence and javax.servlet cause immediate compilation failures.