Skip to content

Java and Spring Boot checklist

Copy this list into a pull request, design review or project kickoff and tick what applies. Rules are grouped by level and sorted by score (criteria). Each links to the file that explains it and cites its sources. Automatable names tools that can check the rule in CI (see the file's "How to enforce" section).

Also apply the general checklist.

This file is generated by python3 scripts/rank.py fix from the guidelines. Don't edit it by hand.

  • SPRING-3 (9) Keep secrets out of application.properties, application.yaml and every other file in the repository: mount them as files and import them with spring.config.import=configtree:, or load them from a secrets manager, for example with Spring Cloud Vault. (specific/spring-boot) Automatable: GitHub secret scanning push protection.
  • SPRING-5 (9) Declare the authorization of every request in each SecurityFilterChain: permit the public paths explicitly, require roles or authorities for the rest, and end with anyRequest().authenticated() or anyRequest().denyAll(). (specific/spring-boot)
  • SPRING-6 (9) Expose only the Actuator endpoints you need over HTTP, and secure every exposed endpoint other than health, with Spring Security rules built on EndpointRequest or by keeping the endpoints behind a firewall. (specific/spring-boot) Automatable: CodeQL, Disabled Spring CSRF protection.
  • SPRING-7 (8) Keep Spring Security's CSRF protection, which is on by default, for every endpoint that browsers call with cookies or HTTP Basic credentials, and exempt only paths that only non-browser clients call, such as APIs authenticated with bearer tokens, with csrf.ignoringRequestMatchers() instead of turning the protection off with csrf.disable(). (specific/spring-boot) Automatable: CodeQL, Disabled Spring CSRF protection.
  • SPRING-9 (8) Manage the schema with Flyway or Liquibase migrations, which Spring Boot runs at startup, and leave spring.jpa.hibernate.ddl-auto at none or set it to validate. (specific/spring-boot)
  • SPRING-14 (8) Run a Spring Boot generation that still has open-source support, and upgrade to the next minor release before its support ends; run it on a Java LTS release that your JDK distribution still updates. (specific/spring-boot) Automatable: OWASP Dependency-Check.
  • SPRING-1 (7) Inject dependencies through constructors, not into fields. (specific/spring-boot) Automatable: ArchUnit GeneralCodingRules.
  • SPRING-8 (7) Use method security (@EnableMethodSecurity with @PreAuthorize and @PostAuthorize) for checks that depend on a method's arguments or return value, such as ownership of a record, and keep a catch-all rule in the SecurityFilterChain. (specific/spring-boot)
  • SPRING-10 (7) Map every association with fetch = LAZY, fetch the data each use case needs up front with join fetch or an entity graph (@EntityGraph in Spring Data JPA), and set spring.jpa.open-in-view=false. (specific/spring-boot)
  • SPRING-11 (7) Define transaction boundaries with @Transactional on the methods of service classes that carry out one use case across several repository calls, and call those methods from other beans. (specific/spring-boot) Automatable: ArchUnit GeneralCodingRules.
  • SPRING-12 (7) On Kubernetes, point the liveness and readiness probes at /actuator/health/liveness and /actuator/health/readiness, keep checks of external systems out of the liveness group, and give the pod a preStop sleep and a termination grace period long enough for the sleep and spring.lifecycle.timeout-per-shutdown-phase. (specific/spring-boot)
  • SPRING-13 (7) Instrument through Micrometer Observation, which Spring Boot uses for metrics and traces, export both over OTLP to an OpenTelemetry Collector, and set the service name with OTEL_SERVICE_NAME or management.opentelemetry.resource-attributes. (specific/spring-boot)
  • SPRING-16 (7) Test controllers with @WebMvcTest and repositories with @DataJpaTest, and run at least the repository and integration tests against the database engine you use in production, started by Testcontainers and connected with @ServiceConnection. (specific/spring-boot)
  • SPRING-2 (6) Package by feature: put the main application class in a root package, give each business capability its own subpackage, and once there are several, enforce the boundaries with Spring Modulith. (specific/spring-boot) Automatable: Spring Modulith verification.
  • SPRING-4 (6) Bind your own settings to @ConfigurationProperties classes instead of scattering @Value annotations, and annotate them with @Validated and Jakarta Bean Validation constraints, so that Spring Boot validates the values when it binds them. (specific/spring-boot)

Conditional (1–5)

  • SPRING-15 (5) Enable virtual threads with spring.threads.virtual.enabled=true only on Java 21 or later, preferably Java 24 or later, and when you do, set spring.main.keep-alive=true and limit concurrency with semaphores or connection pools rather than pools of threads. (specific/spring-boot)