Spring 3.2 with Java 7 and Java 8 - java

I have read following questions related to Spring 3.2 and Java 8 compatibility issues but i still have few open questions.
Java 8 Spring compatibility
spring-core 3.2.9 + java 8
Spring 3.2.x with Java 8
Let's say there is an artifact (e.g. DAL) that uses Spring 3.2 and this artifact has to be shared between java 7 service (Service A) and java 8 service ( Service B). These services will compiled and run against respective Java/JVMs.
Now question is - will it be possible to use DAL in both Service-A and Service-B?
As per snippet 1, it should work because Java 8 runtime supports the Spring 3.2 libraries compiled against Java 7 but as per snippet 2 this shouldn't work as Service-B has been complied against java 8 and it is going to use DAL that has been compiled against java 7.
Snippet 1:
However some spring release notes says that the 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.
Snippet 2:
Versions of the Spring Framework that are older than 4.0M1 do not work with classes that are compiled for Java 8.

There is no point of migrating to Java 8 with Spring 3.x, Its better to move to JDK 1.8 and Spring 4.x. The JDK 8 migration should not be an issue unless the code has to be changed for JDK 8 features.
Spring 3.2.9 will be the best bet in terms of Java 8 byte code support.

Related

How would I find which version of jdk is compatible with Grails 3.2.4?

I was given guidance that it would be jdk.1.8.0_31. However, Googling this jdk did not bring up any results. How could I be certain, and where can I find the download? The newest jdk (17.0.2) will not work with it.
For Groovy 2.4 and below I would stick to java 8, I thinks there were some issues with java 11, some fixed in Groovy 2.5, but you will still see warnings. For Grails 5+, Groovy 3 I would go for java 11. I think better support for Java 17 is coming for Groovy 4.
Grails 3.2.4 uses groovy 2.4.7
Grails 4 uses groovy 2.5.6
Grails 5 uses Groovy 3
Groovy 4 is coming "soon" so it's not in Grails yet
Grails 3 is already EOL so I would get on upgrading.
https://objectpartners.com/2015/05/14/list-of-groovy-versions-for-each-version-of-grails/
https://grails.org/blog/2021-01-22-grails-exciting-updates.html#:~:text=Grails%20Framework%20EOL%20Schedule&text=Grails%202%20will%20be%20EOL,EOL%20after%20September%2030th%2C%202021.
https://docs.grails.org/latest/guide/single.html#dependencyUpgrades
You can find and download that build version of jdk 1.8.0_31 here : https://www.oracle.com/java/technologies/javase/javase8-archive-downloads.html
It should work with grails 3.2.4.
Grails 3 works with more advanced builds versions of java 8 and more recent versions of java too like java 11.
According to the Grails 3.2.4 guide, Java 7 and above should work.
If you really can't use Java 17, the latest long-term support version, I'd recommend Java 11, the previous long-term support version. You can find downloads for all currently-supported versions of Java here.

Minimum Spring version compatible with Java 11

I need to upgrade an app to Java 11 very soon, I was wondering what's the minimum Spring version that is compatible with Java 11.
I'm currently using Java 8 and Spring 4.2.7.
From their task tracker -- SPR-16391:Compatibility with JDK 11. The compatibility of JDK 10, 11 is planned along with 5.1 GA release.
JDK 11 is currently scheduled for September 2018. Not expecting any
major changes beyond JDK 10 from our perspective, we should be able to
fully support it in the 5.1 line already.
Ideally our framework build would be able to run on JDK 8, 9, 10 as
well as 11, even if our own test efforts will focus on JDK 8 and 11
(as the official long-term support branches) at that point.
While the option of experimenting with your own code on module path is still feasible using spring framework 5.0, which provides out-of-the-box support for JDK 9 already.
Update: Spring Framework 5.1 goes GA on 21st September, 2018
Spring Boot version 2.1.0 has been released with full Spring 5.1 and Java 11 support.
What’s new in 2.1
Third-party library upgrades.
We’ve upgraded to the
latest stable releases of other third-party libraries wherever
possible. Some notable dependency upgrades in this release include:
Hibernate 5.3
Micrometer 1.1
Spring Data Lovelace
Spring Framework 5.1
Tomcat 9
Undertow 2
JDK Version Range
Spring Framework 5.3.x: JDK 8-19 (expected)
Spring Framework 5.2.x: JDK 8-15
Spring Framework 5.1.x: JDK 8-12
Spring Framework 5.0.x: JDK 8-10
Spring Framework 4.3.x: JDK 6-8
For more info please visit here source

REST service with java version 7

Can i develop a REST project using java jdk version 7 ? If so where can I get examples?
I have developed a project with jdk version 8 and jax-rs 2.0 , I want my project to be developed with java 7.
Sure you can do it. Eg you could take an older version (<=2.25) of jersey to develop it
jersey documentation

Upgrading Project from JDK 6 to JDK 8

My current project is built on Java 6. I'm thinking of upgrading it to Java 8.
Here is the details of the build.properties
xdoclet.home=D:/**/xdoclet-1.2.3
jboss.deploy.dir=D:/**/jboss-6.1.0.Final
application.dir=D:/**/**/cal
middlegen.home=D:/**/middlegen-2.0-b1
compiler.home=C:/Program Files/Java/jdk1.6.0_24/bin/javac .
I've tried building the project on JDK 8 and it is building successfully.
I know that I have to upgrade every libraries so that it can work with JDK 8.
How can I make sure about the dependencies to be correct as there are so many jars? And also Do I have to change my Jboss Application Server to Wildfly Application Server as Jboss AS 7 doesn't support JDK 8?
Please suggest how to approach. Any help appreciated.
And also let me know if it's better to build the project from Scratch in JDK 8 than upgrading it to JDK 8.
1) If you need to use jdk8 than you have to switch too the newer jboss.
2) It is not required to updated all jar's since jdk8 can run older jars
it there is no compatibility problem.
3) If you already have an large probject it is faster to keep it.
4) You can review your code and use the new java 8 features like "<>" and "try()"
For more qualified answer your question is to unspecific.
I would like to suggest you to update JBOSS 6 to wildfly 8 if there is a change required for the updation of JDK 6 to JDK 8.
But there is some other way!!! you can run your JBOSS 6 externally and add the the project.war file in JBOSS>>standalone>>deployment.
For Upgrade of JDK 8,i would suggest to go through JDK 8 feature and see where you can implement the new feature of java in your source code and have a mock testing class for the same.Make sure you have a mock project as it is the good practice for the enhancement of the project.

Which JDK do Spring Data modules need to run?

My application will be running in a Java 7 JVM. What is the most recent version of Spring-Data-JPA that is compatible with Java 7? Can't find it here or here.
The general baseline of Spring Data modules is JDK 6. However, some of the modules (e.g. Neo4j) required a JDK 7 due to the fact that the store's Java driver already requires JDK 7.
I am using Spring-Data-Jpa 1.8.0 and my application is running ina Java 7 JVM.
If you check the reference for the newest version 1.8.1, you will see that some new features has been added in the favour of java-8 (like the use of Stream but java-7 is still supported.

Categories

Resources