Spring2.5不支持JDK8及其以上的版本,因为有一段校验JDK版本的代码,当JDK版本大于1.7之后,会识别成JDK1.4之前的。会报版本太低的错误。

 /*
* Copyright 2002-2007 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/ package org.springframework.core; /**
* Internal helper class used to find the Java/JDK version
* that Spring is operating on, to allow for automatically
* adapting to the present platform's capabilities.
*
* <p>Note that Spring requires JVM 1.4 or higher, as of Spring 2.5.
*
* @author Rod Johnson
* @author Juergen Hoeller
* @author Rick Evans
*/
public abstract class JdkVersion { /**
* Constant identifying the 1.3.x JVM (JDK 1.3).
*/
public static final int JAVA_13 = 0; /**
* Constant identifying the 1.4.x JVM (J2SE 1.4).
*/
public static final int JAVA_14 = 1; /**
* Constant identifying the 1.5 JVM (Java 5).
*/
public static final int JAVA_15 = 2; /**
* Constant identifying the 1.6 JVM (Java 6).
*/
public static final int JAVA_16 = 3; /**
* Constant identifying the 1.7 JVM (Java 7).
*/
public static final int JAVA_17 = 4;
public static final int JAVA_18 = 4; private static final String javaVersion; private static final int majorJavaVersion; static {
javaVersion = System.getProperty("java.version");
// version String should look like "1.4.2_10"
if(javaVersion.indexOf("1.8.") != -1){
majorJavaVersion = JAVA_18;
}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;
}
} /**
* Return the full Java version string, as returned by
* <code>System.getProperty("java.version")</code>.
* @return the full Java version string
* @see System#getProperty(String)
*/
public static String getJavaVersion() {
return javaVersion;
} /**
* Get the major version code. This means we can do things like
* <code>if (getMajorJavaVersion() < JAVA_14)</code>.
* @return a code comparable to the JAVA_XX codes in this class
* @see #JAVA_13
* @see #JAVA_14
* @see #JAVA_15
* @see #JAVA_16
* @see #JAVA_17
*/
public static int getMajorJavaVersion() {
return majorJavaVersion;
} /**
* Convenience method to determine if the current JVM is at least Java 1.4.
* @return <code>true</code> if the current JVM is at least Java 1.4
* @see #getMajorJavaVersion()
* @see #JAVA_14
* @see #JAVA_15
* @see #JAVA_16
* @see #JAVA_17
*/
public static boolean isAtLeastJava14() {
return true;
} /**
* Convenience method to determine if the current JVM is at least
* Java 1.5 (Java 5).
* @return <code>true</code> if the current JVM is at least Java 1.5
* @see #getMajorJavaVersion()
* @see #JAVA_15
* @see #JAVA_16
* @see #JAVA_17
*/
public static boolean isAtLeastJava15() {
return getMajorJavaVersion() >= JAVA_15;
} /**
* Convenience method to determine if the current JVM is at least
* Java 1.6 (Java 6).
* @return <code>true</code> if the current JVM is at least Java 1.6
* @see #getMajorJavaVersion()
* @see #JAVA_16
* @see #JAVA_17
*/
public static boolean isAtLeastJava16() {
return getMajorJavaVersion() >= JAVA_16;
} }

将相关的类文件打开源码,修改成如上的代码,编译后,替换jar包中的class文件即可

Spring2.5与JDK8的集成问题的更多相关文章

  1. Spring2.0集成Quartz1.5.2调度框架

    Quartz是个开放源码项目,提供了丰富的作业调度集.希望您在阅读完本文并看过代码演示后,可以把Quartz的基本特性应用到任何Java™应用程序中.现代的Web应用程序框架在范围和复杂性方面都有所发 ...

  2. 创建一个 Spring Boot 项目,你会几种方法?

    我最早是 2016 年底开始写 Spring Boot 相关的博客,当时使用的版本还是 1.4.x ,文章发表在 CSDN 上,阅读量最大的一篇有 42W+,如下图: 2017 年由于种种原因,就没有 ...

  3. SpringBoot:工厂模式实现定时任务可配置

    pringBoot:工厂模式实现定时任务可配置 需要:使用springboot,实现定时任务可配置. 定时任务可在代码中写死,在配置文件中配置,这些都不能实现定时任务在服务器不重启的情况下可配置. 为 ...

  4. 任务调度器quartz的使用

    1.quartz的获取. 可參照:Quartz任务调度模型实例 2.开发思路: 要使用定时器quartz.先弄清楚三个概念:调度器.任务.触发器.开发也是依照这三个方面来开发, 1>写一个Job ...

  5. Spring Boot2 系列教程(二)创建 Spring Boot 项目的三种方式

    我最早是 2016 年底开始写 Spring Boot 相关的博客,当时使用的版本还是 1.4.x ,文章发表在 CSDN 上,阅读量最大的一篇有 43W+,如下图: 2017 年由于种种原因,就没有 ...

  6. Deepin安装JavaFX

    1.环境:JDK1.8(目前国内好用的版本里比较流行的是这个版本),deepin 15.11(linux内核是5.2.9,安装了大黄蜂驱动): 2.由于是用的JDK1.8,所以没法用最新的openjf ...

  7. Struts1 Spring2 iBatis2 框架的集成

    这个是属于比较老的框架了,奈何现在公司用的产品就是如此,闲来就搭一个集成框架吧 依赖jar包 antlr-.jar aspectj-.jar aspectjrt.jar aspectjweaver-. ...

  8. 傅老师课堂:Java高级应用之Struts2+Spring2+Hibernate3大集成

    开篇一笑:一对情侣,非常恩爱,但男友喜欢说脏话,一天女友提出要带男友回家吃个饭,见见家长,千叮万嘱让男友别说脏话,男友在家憋了一晚上没说一句脏话,天气寒冷,到走的时候女友家长要出来送他们,男友客气的说 ...

  9. Spring2集成iBatis2

    从数据库中查询一条记录,演示Spring与iBatis的集成 1 编写sqlmaps与Domain对象 <?xml version="1.0" encoding=" ...

随机推荐

  1. 关于在EXCEL中输入01-01-01被转换为2001/1/1怎么解决

    当向EXCEL写入类似'01-01-01'或'01-01'这样的数据时,打开EXCEL时会发现数据变成了2001/1/1和1月1日. 这是由于EXCEL自动转换功能,我们得要在输入前多加一个’号. 而 ...

  2. .NET破解之百分百营销软件系列

    今天在52中看到了一个邮件批量发送工具,感觉不怎么好用,百度一下,找到了百分百系统,虽然也不怎么好用,但还是忍不住P它. 官网:http://www.100qunfa.com/ 百分百不加群提取群成员 ...

  3. R Graphics Cookbook 第3章 – Bar Graphs

    3.1 基本条形图 library(ggplot2) library(gcookbook) pg_mean   #这是用到的数据   group weight 1  ctrl  5.032 2  tr ...

  4. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q115-Q117)

    Question 115You create a timer job.You need to debug the timer job.To which process should you attac ...

  5. Sharepoint学习笔记—习题系列--70-573习题解析 -(Q57-Q59)

    Question 57You update a solution validator.You need to ensure that all SharePoint solutions are vali ...

  6. 【原】IOS中KVO模式的解析与应用

    最近老翁在项目中多处用到了KVO,深感这种模式的好处.现总结如下: 一.概述 KVO,即:Key-Value Observing,它提供一种机制,当指定的对象的属性被修改后,则对象就会接受到通知.简单 ...

  7. Apache Shiro 简介

    使用 Apache Shiro 为 web 应用程序进行用户身份验证 Shiro 是一个 Apache Incubator 项目,旨在简化身份验证和授权.在本文中,了解 Apache Shiro 并通 ...

  8. Linux文件I/O学习

    Linux内核的VFS子系统: 文件描述符     对于内核而言,所有打开的文件都通过文件描述符引用.文件描述符是一个非负整数.当打开一个现有文件或创建一个新文件时,内核向进程返回一个文件描述符.当读 ...

  9. socket服务器开发中的SO_REUSEADDR选项与让人心烦的TIME_WAIT

    1 发现问题 我在开发一个socket服务器程序并反复调试的时候,发现了一个让人无比心烦的情况:每次kill掉该服务器进程并重新启动的时候,都会出现bind错误:error:98,Address al ...

  10. linux把EDT时间修改为CST格式

    初始时间:2012年 09月 14日 星期五 18:15:33 EDT [root@test ~]# mv /etc/localtime /etc/localtime.bak [root@test ~ ...