Spring Boot Best Practices

Chapter 1 · Practice 1 of 4

Run a current Spring Boot release on an LTS Java

From Versions, starters and dependencies

Why it matters

Spring Boot 4.1 needs at least Java 17 and is compatible up to Java 26. It builds on Spring Framework 7, Jakarta EE 11 (Servlet 6.1) and Hibernate 7.

Pick a Java LTS release for production. Java 21 or later is worth it on its own, because it unlocks virtual threads (see the concurrency chapter), and the Boot docs strongly recommend Java 24 or later for the best virtual thread experience.

ComponentSpring Boot 4.1
Java17 minimum, compatible to 26
Spring Framework7.0.9 or above
Embedded serversTomcat 11.0, Jetty 12.1
Build toolsMaven 3.6.3+, Gradle 8.14+ or 9
Native imagesGraalVM 25 or above

Undertow is no longer supported in Spring Boot 4, because it is not yet Servlet 6.1 compatible.

Do

  • Use a Java LTS release in production images
  • Keep the Boot version current within its line
  • Check the system requirements page before a major upgrade