Skip to content

JDK 8 support for Spring 2.5.x [SPR-11899] #16518

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
spring-projects-issues opened this issue Jun 23, 2014 · 5 comments
Closed

JDK 8 support for Spring 2.5.x [SPR-11899] #16518

spring-projects-issues opened this issue Jun 23, 2014 · 5 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement

Comments

@spring-projects-issues
Copy link
Collaborator

Jocelyn N'TAKPE opened SPR-11899 and commented

I know Spring 2.X is no longer supported but is it possible to release a new version supporting JDK 1.8.

static {
     javaVersion = System.getProperty("java.version");
     // version String should look like "1.4.2_10"
     if (javaVersion.indexOf("1.7.") != -1) {
          majorJavaVersion = JAVA_17;
     }
     else if (javaVersion.indexOf("1.6.") != -1) {
          majorJavaVersion = JAVA_16;
     }
     else if (javaVersion.indexOf("1.5.") != -1) {
          majorJavaVersion = JAVA_15;
     }
     else {
          // else leave 1.4 as default (it's either 1.4 or unknown)
          majorJavaVersion = JAVA_14;
     }
}

No further details from SPR-11899

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

I'm afraid this is far outside the support range. Spring Framework 2.5.6 got released in 2008, and it just about covers JDK 6 and - de facto - basic JDK 7 compatibility (even if JDK 7 got released as late as 2011). However, 2014's JDK 8 is six years apart - that's just not feasible anymore.

Please upgrade to at least Spring Framework 3.2.9 which does have basic JDK 8 support - and it contains pretty much all of 2.5.6's support classes still: some of them in deprecated form but still working, thus providing a straightforward upgrade path for 2.5.6 users. Have you tried it?

Note that our full JDK 8 story (including JSR-310 support, repeatable annotations, parameter name discovery) is only available in the Spring Framework 4.x line... 3.2.9 just provides basic compatibility with the JDK 8 bytecode level plus a few further runtime compatibility tweaks.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Jocelyn Ntakpe commented

Thanks for your answer.
Our new applications will be developped with spring 4 or spring 4.1. Still we wanted to upgrade old ones to Jdk8 without migrating spring too.

@spring-projects-issues
Copy link
Collaborator Author

Juergen Hoeller commented

Any specific reason why upgrading your older apps to Spring Framework 3.2.9 wouldn't work? Did you try a smoke test, simply bumping up the build dependency from 2.5.6 to 3.2.9?

FYI, we're doing a 3.2.9 service release in July. Let me know whether there's anything we can do for you there. There'll be a further 3.2.9 service release later this year, if needed.

Juergen

@spring-projects-issues
Copy link
Collaborator Author

Jocelyn Ntakpe commented

Thanks for the advice. Indeed will try 3.2.9 migration.

@spring-projects-issues
Copy link
Collaborator Author

C D commented

You could also just overwrite this class.
That is what I did on two projects that are still using Spring 2.X.
After downloading the source add the following:
public static final int JAVA_18 = 5;
...
static{
javaVersion = System.getProperty("java.version");
// version String should look like "1.4.2_10"
if(javaVersion.contains("1.8.")){
majorJavaVersion = JAVA_18;
// System.out.println("JAVA_VERSION: " + javaVersion);
}else if(javaVersion.indexOf("1.7.") != -1){
majorJavaVersion = JAVA_17;
}else if(javaVersion.indexOf("1.6.") != -1){
majorJavaVersion = JAVA_16;
}else if(javaVersion.indexOf("1.5.") != -1){
majorJavaVersion = JAVA_15;
}else{
// else leave 1.4 as default (it's either 1.4 or unknown)
majorJavaVersion = JAVA_14;
}
}

@spring-projects-issues spring-projects-issues added status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement in: core Issues in core modules (aop, beans, core, context, expression) labels Jan 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) status: declined A suggestion or change that we don't feel we should currently apply type: enhancement A general enhancement
Projects
None yet
Development

No branches or pull requests

2 participants