Java 8 to Java 21 upgrade
What breaks when moving a large Java 8 Spring app to Java 21, and what wins do you highlight?
Answers use simple, clear English.
Quick interview answer
Breaks: removed APIs (javax→jakarta if Spring Boot 3), illegal reflective access, deprecated SecurityManager usage, old bytecode libs. Wins: virtual threads for servlet latency, improved GC (ZGC/G1), records/sealed classes for DTOs, pattern matching. Plan: CI matrix on 17 then 21, jdeps report, load test with virtual threads on I/O endpoints.
Detailed answer
Breaks: removed APIs (javax→jakarta if Spring Boot 3), illegal reflective access, deprecated SecurityManager usage, old bytecode libs. Wins: virtual threads for servlet latency, improved GC (ZGC/G1), records/sealed classes for DTOs, pattern matching. Plan: CI matrix on 17 then 21, jdeps report, load test with virtual threads on I/O endpoints.
Real example & use case
Order API thread pool 200 → virtual threads; p99 latency drops on DB-heavy endpoints.
Pros & cons
Pros: perf + security patches. Cons: dependency upgrades (Spring 6), test effort.