For Spring boot version greater than 2.7.5 is java 17 required or we can use jdk 11 or 8 – Spring-boot

by
Ali Hasan
spring-boot

Quick Fix: Spring Boot 2.x requires at least Java 8 while Spring Boot 3.x requires Java 17 or later.

The Problem:

For Spring Boot versions greater than 2.7.5, is Java 17 a mandatory requirement, or can we still utilize JDK 11 or 8? If yes, why is this detail not explicitly stated in the release notes? However, for Spring Boot 3.0, the documentation clearly specifies that Java 17 is the minimum required version. Can the Spring team provide clarification on this matter?

The Solutions:

Solution 1: Clarification of Java Version Requirements

For Spring Boot versions 2.x (including 2.7.5), the minimum required Java version is 8. This is clearly mentioned in the official Spring Boot documentation under the "System Requirements" section. Spring Boot 2.7.x supports Java 8 to 20 inclusive.

However, for Spring Boot 3.x, the minimum required Java version is 17. This is also documented in the official documentation for Spring Boot 3.0. Spring Boot 3.0 supports Java 17 to 20 inclusive.

Solution 2: Java Versions Compatibility

For Spring Boot versions less than 3.x, both Java 8 and Java 11 are supported. However, Java 17 is required for Spring Boot 3.x and later.

While the release notes for Spring Boot 2.7.5 do not explicitly state this requirement, it is implicit in the documentation for Spring Boot 3.0, which clearly indicates that Java 17 is the minimum required Java version.

Solution 1: Java 17 Not Required for Boot 2.7.5+

While Spring Boot 3.0 requires Java 17, Spring Boot 2.7.5 and later versions do not have this requirement. This means you can continue using Java 11 or 8 with these versions without any issues.

The reason for this is that Spring Boot 2.7.5+ still mostly relies on libraries that are compatible with Java 8+. However, with the introduction of Java 17, some of these libraries have evolved and now require Java 17.

To ensure a consistent experience across all supported Java versions, Spring Boot 2.7.5+ ships with a compatibility layer that allows these libraries to run on earlier Java versions. This layer translates the new Java 17 features into equivalent functionality on older versions.

As a result, you can still use Spring Boot 2.7.5+ with Java 11 or 8, but you may not have access to all the latest features and optimizations available in Java 17.

Q&A

Is java 17 required for spring boot versions greater than 2.7.5?

No, Java 8 or 11 can still be used.

Why is the minimum required Java version not mentioned in Spring Boot release notes for versions prior to 3.0?

Because a minimum version is not required for those versions.

Can you clarify if Java 17 is only required for Spring Boot 3.0 or later?

Yes, Java 17 is only required for Spring Boot 3.0 and later.

Video Explanation:

The following video, titled "Spring Security without the WebSecurityConfigurerAdapter - YouTube", provides additional insights and in-depth exploration related to the topics discussed in this post.

Play video

If you are using Spring Boot 2.7.x or above you will need to understand how to use Spring Security without the WebSecurityConfigurerAdapter ...