Spring Boot Skill
Apply the practices below when developing Spring Boot applications. Read the linked reference only when working on that area.
Maven pom.xml Configuration
Read references/spring-boot-maven-config.md for Maven pom.xml configuration with supporting plugins and configurations to improve code quality, and testing.
Package structure
Read references/code-organization.md for domain-driven, module-based package layout and naming conventions.
Spring Data JPA
Implement the repository and entity layer using references/spring-data-jpa.md.
Service layer
Implement business logic in the service layer using references/spring-service-layer.md.
Spring MVC REST APIs
Implement REST APIs with Spring MVC using references/spring-webmvc-rest-api.md.
Spring Modulith
Build a modular monolith with Spring Modulith using references/spring-modulith.md.
Thymeleaf
If Thymeleaf is used for view templates, refer references/thymeleaf.md
Testing
Write tests at complementary levels — unit, sliced Spring tests, and at least one end-to-end/smoke test; the levels are not either/or. Most framework-touching tests belong at the fast sliced level (@SpringBootTest(classes = …) or a slice annotation); keep full-context @SpringBootTest for a smoke test plus a request-level end-to-end. For why the levels are complementary and how to keep a large suite fast (context caching, one container for the suite), read references/testing-strategy.md.
All persistence and integration tests use Testcontainers with a real database (never in-memory H2); see references/testcontainers-wiring.md for @ServiceConnection vs dynamic-property wiring.
Test Data Setup
Prefer SQL fixtures with @Sql("classpath:/test-data.sql") before every test method.
When setting up data programmatically, prefer exposed Services or ModuleAPI classes over Repositories, JdbcTemplate, or JdbcClient.
Unless absolutely necessary, avoid using JdbcTemplate, JdbcClient, or TransactionTemplate
to execute SQL for test data setup, which couples tests to internal implementation details.
Read references/test-data-setup.md when creating or changing test fixtures.
Write ArchUnit Tests
To write tests for testing the architecture using ArchUnit, refer references/archunit.md
Spring Boot Docker Compose Support
To use Docker Compose support for local development, refer references/spring-boot-docker-compose.md.
Taskfile
Use references/taskfile.md for easier commands execution.