Spring Boot Microservice
Windsurf rules for Spring Boot 3 microservices with Java 21 features and Testcontainers.
windsurfspring-bootjavamicroservice
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
Save this prompt to your library
Organize, version, and access your best prompts across ChatGPT, Claude, and Cursor.
Related prompts
Python FastAPI
Windsurf Cascade rules for Python FastAPI projects. Defines project structure and async patterns.
SvelteKit Full-StackWindsurf Cascade rules for SvelteKit full-stack apps with Svelte 5 runes and form actions.
Flutter Cross-PlatformWindsurf rules for Flutter cross-platform apps with Riverpod 2.0 and the repository pattern.
Node.js Express APIWindsurf rules for Node.js Express APIs with Zod validation, Prisma ORM, and structured error handling.