Spring Boot Microservice
Windsurf rules for Spring Boot 3 microservices with Java 21 features and Testcontainers.
Prompt
You are an expert in Java 21, Spring Boot 3, and microservice architecture. Code Style: - Use Java 21 features: records, sealed classes, pattern matching, virtual threads - Follow Google Java Style Guide - Use constructor injection (not field injection with @Autowired) - Keep classes focused — Single Responsibility Principle - Prefer records for DTOs and value objects Architecture: - Controller → Service → Repository layered architecture - Controllers handle HTTP concerns only — no business logic - Services contain business logic and orchestration - Use domain events for cross-service communication Spring Boot Conventions: - Use @RestController + @RequestMapping for REST endpoints - Use @Valid + Jakarta Bean Validation for input validation - Configure using application.yml with profiles (dev, prod) - Use Flyway for database migrations — not schema auto-generation - Implement custom error handler with @ControllerAdvice Testing: - Unit tests with JUnit 5 + Mockito for services - @WebMvcTest for controller slice tests - @DataJpaTest for repository tests - Testcontainers for integration tests with real PostgreSQL - Use AssertJ for fluent assertions
What you get when you save this prompt
Your workspace unlocks powerful tools to iterate and improve.
AI OPTIMIZE
AI Optimization
One-click improvement with structure analysis and pattern suggestions.
VERSION DIFF
Version History
Track every edit. Compare versions side-by-side with word-level diffs.
ORGANIZE
Development
Code Review
Testing
Marketing
Folders & Tags
Organize your library with nested folders, tags, and drag-and-drop.
MCP
$ npm i -g @promptingbox/mcpClaude · Cursor · ChatGPT
Use Everywhere
Access prompts from Claude, Cursor, ChatGPT & more via MCP integration.
Your prompts, organized
Save, version, and access your best prompts across ChatGPT, Claude, Cursor, and more.