Does Spring support OpenJDK 12 - java

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.)

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

Getting ClassNotFoundException for HttpServlet in Tomcat in INtellij [duplicate]

I have a Java application which shows Apache Tomcat Embed as 9.0.35 version. I need to update this to 10.0.4. I'm very new to Java and have very minimal knowledge on it. This upgrade is needed to resolve some vulnerabilities with in the application.
How can I do this from IntelliJ IDE?
Tomcat 9 & 10 are equivalent products
Apache Tomcat 9 and 10 are equivalent products. The only difference is support for changes for the package names in the Jakarta Servlet and related technologies from javax.* to jakarta.*.
This package name change is for legal reasons involved in the transfer of responsibility for Jakarta EE (formerly Java EE) technologies from Oracle Corp to the Eclipse Foundation.
For more info, read Understanding Jakarta EE 9.
To quote the documentation:
Users of Tomcat 10 onwards should be aware that, as a result of the move from Java EE to Jakarta EE as part of the transfer of Java EE to the Eclipse Foundation, the primary package for all implemented APIs has changed from javax.* to jakarta.*. This will almost certainly require code changes to enable applications to migrate from Tomcat 9 and earlier to Tomcat 10 and later. A migration tool is under development to aid this process.
Move to the latest 9 rather than 10
Tomcat 9 and 10 track the same development changes. If your goal is simply to gain some security fixes, as far as I know you'll get the same fixes in both 9 and 10. Do not take my word for this, just study the Tomcat Release Notes.
So for the fastest easiest migration path, just upgrade to the latest 9 instead of 10. The current latest version of 9 is 9.0.44.
Stick with Tomcat 10
Alternatively, if you want to proceed with using Tomcat 10, change the import statements across your code base to use jakarta.* in place of javax.*.
IDEs such as IntelliJ have added features to assist in this migration chore.
And you’ll need to update any third-party libraries using javax.* to new versions using jakarta.*.

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.

Do I need Spring 5 for Java 9?

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.

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