Spring

 View Only

 is Spring 3.x compatible with Java 8

Gary Gu's profile image
Gary Gu posted Feb 13, 2019 04:22 AM

is Spring 3.x compatible with Java 8

Daniel Mikusa's profile image
Daniel Mikusa

Kind of...

Along with 4.0 M1, we’ve released Spring Framework 3.2.3, containing fixes for recently reported issues but also coming with OpenJDK 8 runtime support. Spring Framework 3.2.x will support deployment on JDK 8 runtimes for applications compiled against JDK 7 (with -target 1.7) or earlier. Note that it won’t support JDK 8’s bytecode format (-target 1.8, as needed for lambdas); please upgrade to Spring Framework 4.0 for that purpose.

It basically works as long as you're on 3.2.3+ and are compiling your Java code to Java 7's byte code format.

 

For what it's worth Spring 3 is *very* old and unsupported. You should upgrade to a more recent version ASAP. That will also get you Java 8 support.

Daniel Mikusa's profile image
Daniel Mikusa

If you're running Spring 3.2.3+, it should work. You need to make sure that the target of the Java compiler is set to `1.6` or `1.7`. That will tell it to generate byte code for those older versions of the JVM. As long as you set the target, it shouldn't really be any different than compiling with Java 6 or Java 7.

Gary Gu's profile image
Gary Gu

Hi Daniel, thank you so much for your response.

 

I would like to ask this question probably more specific and hopefully you can give us some advice -  we plan to update our JDK/JRE to 8 just because Java 6 is going out of support. So we will not use Java 8 feature such as Lamda, etc. Just want to keep the same version of Spring, compile our application code under Java 8. Does this work for Spring 3.x? (will upgrade Spring to 4.x in the new future)​. I can not imagine in general if an application is compiled with and runs under new Java version will break with third party code which is compiled in previous version of Java, if we don't try to use new feature of new Java version.

 

Thanks for your help and hope you can give some advice on this.

 

Thanks

ggu