Do I need Spring 5 for Java 9? - java

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?

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.

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.

Related

Upgrade to Elasticsearch 8 from 7.16

We deploy standalone ES pods and I saw that the system requirements say that Java 17 or higher is to be used. The java applications (separate pods of course) depending on ES are still on java 8 and we have no intention of upgrading the java version anytime soon. I wanted to confirm with the community at large if they faced issues any issues calling ES from applications on java 8? We are using the standard ES java libraries
org.elasticsearch.client:elasticsearch-rest-client
org.elasticsearch.plugin:parent-join-client
org.elasticsearch:elasticsearch-core
org.elasticsearch:elasticsearch
org.elasticsearch.client:elasticsearch-rest-high-level-client
I know restHighLevelClient is deprecated but we depend on spring-data-elasticsearch to provide some of the integration support.
I don't have enough reputation to add comment. I have similar problem on the upgrade. Here is from readme https://github.com/spring-projects/spring-data-elasticsearch
In Elasticsearch 8, the RestHighLevelCLient has been removed. This means that a switch to this client version can only be done with the next major upgrade which will be Spring Data Elasticsearch 5, based on Spring Data 3, used by Spring Boot 3, based on Spring 6 and Java 17.
Below has dependencies and upgrade info.
https://www.elastic.co/guide/en/elasticsearch/reference/current/dependencies-versions.html
https://www.elastic.co/guide/en/elasticsearch/reference/current/setup-upgrade.html

Spring 5.1.5.RELEASE what should i think to chose a JVM version

I am having an application running on JAVA - AIX platform, I am trying to move my spring application to Spring version 5.1.5.RELEASE.
I cannot upgrade my JVM which is currently in version 'J9VM - R28_20170209_0201_B336038'
The application does run in the above JVM version, but I am not sure if I have to upgrade to the latest JVM too to benefit on the latest Spring version!?
Is there any documentation on the JVM to chose for a spring version?
PS: My application does not work on any higher JVM version, which I have to sort out first.
See JDK Version Range on the Spring Framework Versions page, which currently says:
Spring Framework 5.1.x: JDK 8-12
Spring Framework 5.0.x: JDK 8-10
Spring Framework 4.3.x: JDK 6-8
We fully test and support Spring on Long-Term Support (LTS) releases of the JDK, i.e. currently JDK 8 and 11 (both with a lifetime until 2023). Additionally, there is support for intermediate releases such as JDK 9/10 or the upcoming JDK 12 on a best-effort basis, meaning that we accept bug reports and will try to address them as far as technically possible but won't provide any service level guarantees.
Please upgrade to Spring Framework 5.1 (and the corresponding Spring Boot 2.1) for JDK 11 support, as the common Long-Term Support migration path from JDK 8. No earlier Spring versions are officially supported on JDK 11, in particular not with JDK 11 bytecode level. Note that third-party components might not fully support JDK 11 yet, so you are likely to be limited in your full-stack options.

Does Spring support OpenJDK 12

We are planning to migrate our application from Oracle JDK 8 to OpenJDK 12. Currently we are using Spring Boot version 1.4.5.RELEASE.
I have read many articles saying that from Spring Boot 2.2.X, we will have support for OpenJDK 12. Please provide your inputs.
According to the Spring Framework Wiki (as per the August 2020 update)
JDK Version Range
Spring Framework 5.3.x: JDK 8-17 (expected)
Spring Framework 5.2.x: JDK 8-15 (expected)
Spring Framework 5.1.x: JDK 8-12
Spring Framework 5.0.x: JDK 8-10
Spring Framework 4.3.x: JDK 6-8
We fully test and support Spring on Long-Term Support (LTS) releases of the JDK, i.e. currently JDK 8 and 11 (both with a lifetime until 2023) and expecting JDK 17 (to be released in late 2021). Additionally, there is support for intermediate releases such as JDK 9/10/12/13/14 and the upcoming JDK 15/16 on a best-effort basis, meaning that we accept bug reports and will try to address them as far as technically possible but won't provide any service level guarantees.
Please upgrade to Spring Framework 5.1+ (and the corresponding Spring Boot 2.1+) for JDK 11+ support, as the common Long-Term Support migration path from JDK 8. No earlier Spring versions are officially supported on JDK 11, in particular not with JDK 11 bytecode level. Note that third-party components might not fully support JDK 11 yet, so you are likely to be limited in your full-stack options.
The above Wiki page is updated regularly, and you are advised to check it yourself.
If you switched to Spring 5.1.x, you will be OK on Java 12.
As for Spring Boot, 2.1 is good for Java 11. Spring Boot 2.2 supports up to Java 13.
(You can look up the versions of Java supported for a given Spring Boot release by looking at the "Getting Started" page of its reference documentation.)

Use Java 10 with Spring MVC 5

Currently I am using Java 8 and Spring MVC 4. I want to upgrade java into 10 and spring into 5. So Is Spring MVC 5 is compatible with Java 10 ?
They added support for JDK9 features, most notably the Flow API (cf their documentation). And, as far as I know, it seems compatible with JDK10.
The language changes in java 10 are pretty minor and retro-compatibles. I'm using spring 5 with java 10 and still haven't noticed any regression.
Looking to the service Spring Initializr in full version it is possible to choose between java 8 and java 10, so I think that it is fully compatible.

Spring 3.2.x with Java 8

We are currently using spring 3.2.9. We are thinking of upgrading that to a newer version. When I checked the documentation it says that
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.
Does that imply that I can't compile on Java 8?
Should I use spring version 4.0.x if I wanna compile with Java 8?
There is a best effort support of JDK8 in the 3.2.x line, as of 3.2.9+.
See SPR-11656 for initial support in 3.2.9 and SPR-11979 for bytecode support improvements in 3.2.10. Please note the support limitations explained in the comments.
For comprehensive support of JDK8, please upgrade to Spring 4.x - there's a dedicated wiki page explaining the upgrade path, and the Spring team made great efforts to make that upgrade experience really easy.
As per my observations, you can actually use spring 3 with code compiled in Java 8, as long as you do not use new java8 syntax in there (like lambdas) in the paths scanned.
So, you can use new APIs (streams ...), but not new syntax (lambdas...).
When I tried, I ended up with startup errors like org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class
Versions of the Spring Framework that are older than 4.0M1 do not work with classes that are compiled for Java 8.
Spring tries to Proxy these classes by reading class files, which won't work if they're "too new". If your #Service classes are compiled with Java 8 as the target, Spring will fail to load the classes on startup.
This means that you will have to upgrade to Spring 4.x.x, if you want to target Java 8 (and use lambdas, default implementations and so on).
I encountered this problem myself a few months ago with a project that uses Spring 3.x.x.

Categories

Resources