J21
Spring Review Field Guide
v1.0 / JAVA 21 / SPRING BOOT 3.5.13
/ field guide / interactive

A structured way to review Java Spring code — without missing things.

Five phases, deep-dive panels, runnable code examples, an end-to-end request diagram, and a 10-question quiz. Built for engineers reviewing Spring Boot 3.5.x apps on Java 21.

/ at-a-glance
  • Phases5
  • Code examples28+
  • Anti-patterns19
  • External refs22
  • Quiz items10
/ 01 / process diagram

Request lifecycle & review checkpoints

Trace one HTTP request from boundary to database. Each stop is a review checkpoint — click to reveal what to look for, code samples, and references.

// HTTP_REQUEST → PERSISTENCE → HTTP_RESPONSE trace_id: 0x4f...c1 CLIENT Browser / SPA curl, fetch, RestTemplate POST /api/orders FILTER CHAIN Spring Security Auth · CORS · CSRF @PreAuthorize CONTROLLER @RestController @Valid · DTO mapping ResponseEntity<T> SERVICE @Service @Transactional · rules business logic REPOSITORY JpaRepository @Query · @EntityGraph Spring Data JPA DATABASE PostgreSQL HikariCP pool · Flyway SELECT · INSERT // CROSS-CUTTING CONCERNS Logging & Tracing SLF4J · Logback · MDC Configuration application.yml · @Value Exception Handling @RestControllerAdvice Async & Threads @Async · Virtual Threads Observability Actuator · Micrometer Testing JUnit 5 · Mockito · TC ► tap any node to inspect review checkpoints
interactive — click a node above
/ 02 / methodology

The five-phase review

Each phase builds the next. Click a card to expand checkpoints, code, and references.

/ 03 / language features

Java 21 features — what to praise, what to flag

Java 21 is the LTS baseline. Reviewers should reward idiomatic use of records, sealed types, pattern matching, and virtual threads — and challenge legacy idioms that ignore them.

/ 04 / concurrency

Threads, virtual threads, futures & queues

Concurrency is where Spring apps quietly fall over. Java 21 introduced production-ready virtual threads. Most reviewers underestimate this section — do not.

/ enable virtual threads in spring boot 3.5.x

One property turns on virtual threads for Tomcat and @Async. Use Boot 3.5.x for full integration.

/ completablefuture — common review pitfalls

Always pass an explicit executor. The default ForkJoinPool.commonPool() is shared globally.

/ 05 / testing & coverage

Mockito, slices, Testcontainers & JaCoCo

A passing build is not a green light. Walk the test pyramid and demand each level is honest.

LAYER SLICE / TOOL WHAT TO VERIFY SMELL TO FLAG
/ mockito service test — the canonical pattern
/ testcontainers integration test
/ jacoco — pom.xml fragment with quality gate

Coverage targets are not the goal — they are a floor. Set gates per package; meaningful tests beat percentage theatre.

/ 06 / configuration · logging · lombok

Properties, profiles, structured logging & Lombok

The boring layers are where production incidents hide. Read them as carefully as the code.

/ application.yml — recommended baseline
/ @ConfigurationProperties — typed & validated
/ structured logging with MDC
/ lombok — when to allow, when to refuse

Lombok is fine for value objects but Java 21 records often replace it. Refuse @Data on JPA entities — it generates broken equals/hashCode for managed entities.

/ time & timezones — the silent bug factory

Storage in UTC; presentation in the user's zone. Never use java.util.Date in new code; the java.time API is mandatory.

/ 07 / output

Severity model & example findings

Findings without severity are noise. Use a four-tier scale — everyone on the team should know what each level means before the review hits inbox.

FINDING PHASE SEVERITY RECOMMENDED FIX
/ 08 / assessment

10-question review quiz

Each question reflects a real review encounter. Read the snippet, pick the strongest answer, then read the rationale. Score updates live.

0 / 10 · 0%
/ 09 / references

External references & further reading