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. 常用 windows运行命令

    winver---------检查Windows版本 wmimgmt.msc----打开windows管理体系结构(WMI) wupdmgr--------windows更新程序 wscript--- ...

  2. 关于停止AsyncTask和Thread的问题

    在java的线程中,没有办法停止一个正在运行中的线程.在Android的AsyncTask中也是一样的.如果必须要停止一个线程,可以采用这个线程中设置一个标志位,然后在线程run方法或AsyncTas ...

  3. pycharm安装与实践

    PyCharm简介 PyCharm是一种Python IDE,带有一整套可以帮助用户在使用Python语言开发时提高其效率的工具,比如调试.语法高亮.Project管理.代码跳转.智能提示.自动完成. ...

  4. android项目中gen目录不能自动生成R.java的原因

    1.调用的资源文件不存在:xml文件中有些控件没有关联引用:把项目缺少的文件加上,包括资源文件,如 values中的strings.xml或者图片等资源. 2.项目中缺少必须的系统文件(比如:defa ...

  5. CSS 属性选择器(八)

    一.属性选择器 属性选择使用中括号进行标识,中括号内包含属性名,属性值或者属性表达式 如h1[title],h1[title="Logon"], 二.属性选择器分类 2.1.匹配属 ...

  6. Mysql锁初步

    存储引擎 要了解mysql的锁,就要先从存储引擎说起. 常用存储引擎列表如下图所示: 最常使用的两种存储引擎: Myisam是Mysql的默认存储引擎.当create创建新表时,未指定新表的存储引擎时 ...

  7. NSTimer定时器的使用

    前言:这是关于NSTimer的学习笔记. 正文内容大纲: 1.关于计时器NSTimer的一个被添加进NSRunLoop的使用细节 2.关于NSTimer常用方法的使用 3.关于NSTimer的类别工具 ...

  8. RunTime(运行时机制)

    1>runtime实现的机制是什么,怎么用,一般用于干嘛? 这个问题我就不跟大家绕弯子了,直接告诉大家, runtime是一套比较底层的纯C语言API, 属于1个C语言库, 包含了很多底层的C语 ...

  9. 第八章 了解tempdb数据库

    1.一个sqlserver数据库实例上只能有一个tempdb数据库,这个实例上所有的用户都共享这个数据库.2.tempdb数据库在每次sqlserver重启后都会重新创建,所以数据会丢失.3.因为te ...

  10. oracle表相关

    堆表 数据以堆的形式管理,增加数据时会使用段中找到的第一个能放下数据的自由空间,我们见到的绝大部分的表都是堆表.堆表是数据库的默认表类型. 最简单的情况是 create table test (c1 ...