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.
Related
Im having an api slowness issue after upgrading my application from Java 7 to Java 8 and SPring 3 to Spring 4
I was tasked to upgrade our application simple API that have JDK 7 and Spring 3 , to JDK 8 and Spring 4 , performance before was 300 ms and now its 1100 ms
I tried using Jmeter for testing and running it on local and remote machine its still the same result
Any suggestions how can I improve or determine the culprit of my issue?
New Performance with JDK8 and Spring 4
OLd Performance with JDK7 and Spring 3
New Performance with JDK8 and Spring 4 Summary
OLd Performance with JDK8 and Spring 4 Summary
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.
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.
I'm trying to deploy the java Pet Store sample App, and it's documentation says that:
Java Pet Store 2.0 is the reference application for building AJAX
web applications on Java EE 5.
So does that mean it might not be compatible with the newer Java EE 6?
In Java world, backwards compatibility is very important. Java EE 5 applications are definitely backwards compatible with Java EE 6. I.e., they can perfectly run on a Java EE 6 container.
It only means that it's designed and developed for Java EE 5 and does not utilize all available Java EE 6 features, like as the new builtin and Ajax-enabled MVC framework JSF 2.0. It also basically means that you're viewing and playing with an outdated demo application and that the demo is not necessarily built using latest best practices. Java EE 5 is over 5 years old already.
I am facing an strange issue. I developed java web app in java 6 and when I hosted it on server, its shows error since its java 5 server. I have used annotations, hibernate, rest API in my code and now I want to transform my code with java 5 environment.
is it possible to do so? if yes HOW? Or is there any other workaround for this problem? Please let me know.
#all: This is the error i am getting:
I am not sure what your build process is but you need to compile your code for a specific target like java 1.5.
If you are using javac from the command line look at the -target switch
If you are using ant then look at the target property.
You will run into problems if you are using java 1.6 specific libraries. You will know this when you try and run your code/webapp.
I hope this helps.
You'll have to look at the individual errors and figure out what is missing.
The JPA annotations were already part of Java EE 5, so if "hibernate" is causing problems, it either means you are not in fact running on Java EE 5, or you're using hibernate-specific annotations. The REST annotations were indeed added in Java EE 6, but can be used in a Java EE 5 environment relatively easily by adding a JAR with the API as well as the implementation (e.g. Apache Jersey) to the app's class path.
BTW, there's some confusion here concerning Java SE vs. Java EE. You're clearly talking about Java EE features, but there is a big difference between Java SE (which most people think about when you just say "Java") and Java EE.
From your post, it seems you're using Java EE 6 features in a Java EE 5 environment. If your app. server doesn't support such features at its core level, such as sing Servlet 3.0 features in a Servlet 2.5 environment, then you're out of luck.
However, when using features that are libraries, like Hibernate, you can get away using it in a Java EE 5 environment.
Java 6 as a language remains the same as Java 5, however, libraries have changed. Likewise, using JRE classes and methods that are in 6, won't work in 5.
Update: from your screenshot, I see that you're using Java 6 compiled classes on an older version of Tomcat. Compile them for Java 5.
You are trying to run classes compiled against Java 6 on Java 5 (Tomcat 5.x uses Java 5).
You can upgrade to Java 6.
You can compile the classes to be Java 5 compatible by using "-target" argument to javac but this option is not going to help as the problem is occuring with the servlet api. JEE6 requires Java 6.