Do I need Spring 5 for Java 9?
Asked Answered
B

2

12

Spring 5 is promoted as "with support for JDK 9", meanwhile the documentation for Spring 4.3.13 states that it supports Java 8 (as well as 6 and 7).

Does this mean that I need to upgrade to Spring 5 before I can

  • run my application in JRE 9?
  • compile my application using JDK 9?
Breve answered 2/11, 2017 at 16:2 Comment(1)
See this: keyholesoftware.com/2017/06/19/migrating-to-java-9 -- Java 9 seems to be less backward-compatible than its forebears, and there are some gotchas to work through. However it can be done.Aruba
K
13

Spring

On the official Spring blog, they announced that Spring 4.2 would support Java 7 and 8 (it didn't change in 4.3), and they also said that Spring 5 would support Java 9.

It is implied that Spring 4 won't support Java 9.

But it depends of what you're doing: on this blog, the writer is testing Java9 on Spring 4 and he said:

However, before we begin, a quick disclaimer: I will be demonstrating migrating Spring 4.x/Spring Boot 1.x applications to Java 9. As far as I have heard, there will be little to no formal support for either in Java 9. So far, I haven’t run into many issues once I have gotten the applications running, however, as these are primarily proofs of concept, they have not been thoroughly vetted.

Because "doesn't support" only means you're not sure of the comportment, If you're using anything that changed in Java9, you should consider migrating (unless you can test it first).


Spring Boot

Spring boot 1.x does not support Java9. If you want to use it, you have to migrate to Spring Boot 2.x.

Kimbra answered 2/11, 2017 at 16:25 Comment(0)
B
5

Actual

For all that sake, if you are planning to compile your code built with Spring 4.x with Java9 it should just work fine based on the backword compatbility of Java9 which has though been in question for certain implementations and the precise answer there would be dependent on your usage of spring as and when you move ahead and try out things.

Theories

The 5.0.0-RC1 release of Spring framework was announced with the support for Java 8+. The announcement included the theme declared for Java9 pertaining development as well:-

Ready for JDK 9: fully aligned with JDK 9 at runtime, on the classpath as well as the module path (on the latter: as filename-based “automatic modules” for the time being).

This candidate is currently available since November 1, 2017 which can be used from

repositories {
    maven { url 'http://repo.spring.io/libs-milestone' }
}

compile "org.springframework.integration:spring-integration-core:5.0.0.RC1"

The certain good news to look for on that note would be :

We expect GA in a couple weeks - just in time for Spring Boot 2.0 GA!


Pertaining to Spring Boot with Java 9, the requirements are clear such that 2.x vs 1.x are categorized separately :

Spring Boot 2 is the first version to support Java 9 (Java 8 is also supported). If you are using 1.5 and wish to use Java 9 you should upgrade to 2.0 as we have no plans to support Java 9 on Spring Boot 1.5.x.

To keep an eye on the updates over the same, you can follow the Java 9 theme tracker as well as the 2.0 in Progress.

So the ideal world would be, migrating to making use of Spring 5.x/Spring Boot 2.x and Java 9 to get support over the latest features and any incompatibilities found further.

Boyt answered 3/11, 2017 at 2:4 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.