spring2.5 jdk1.8
今天运行一个14年基于spring2.5的项目,出现下面错误
Unexpected exception parsing XML document from class path resource ...............
Context namespace element 'component-scan' and its parser class [org.springframework.core........
解决方法,在项目中创建下面的类,运行即可消除该错误
- /*
- * 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;
- }
- }
spring2.5 jdk1.8的更多相关文章
- Spring2.5与JDK8的集成问题
Spring2.5不支持JDK8及其以上的版本,因为有一段校验JDK版本的代码,当JDK版本大于1.7之后,会识别成JDK1.4之前的.会报版本太低的错误. /* * Copyright 2002-2 ...
- Spring2.5整合Ibatis入门级开发实例
分类: SPRING IBATIS2010-11-22 20:19 1170人阅读 评论(0) 收藏 举报 ibatisspringstringpropertiesclassuser 最近一直在看 ...
- JDK1.5以后的版本特性
一.JDK1.5新特性 1.泛型:泛型的本质是参数化类型,也就是说所操作的数据类型被指定为一个参数.这种参数类型可以用在类.接口和方法的创建中,分别称为泛型类.泛型接口.泛型方法.可以在编译的时候就能 ...
- Java入门到精通——调错篇之Spring2.5利用aspect实现AOP时报错: error at ::0 can't find referenced pointcut XXX
一.问题描述及原因. 利用Aspect注解实现AOP的时候出现了error at ::0 can't find referenced pointcut XXX.一看我以为注解写错了,结果通过查询相关资 ...
- Java入门到精通——调错篇之Spring2.5使用AOP时报错only available on JDK 1.5 and higher
一.问题描述及原因. 在Spring2.5Aop例子中的时候会出现一个错误only available on JDK 1.5 and higher,大概意思就是需要JDK1.5甚至更高版本.但是我用的 ...
- CentOS安装JDK-1.7
注:以下所有操作均在CentOS 6.5 x86_64位系统下完成. #准备工作# 准备用rpm下载前,看系统是否已经安装有JDK,如果没有则进入正式安装步骤. # rpm -qa | grep jd ...
- ubuntu 14.04 配置 jdk1.8
自己在Ubuntu中安装jdk1.8的步骤,记录以方便以后查询. 将下载好的jdk安装包移到/usr/local目录中(我喜欢将自己安装的软件放在/usr/local目录中),解压缩 sudo tar ...
- Linux下安装jdk1.7、Apache-tomcat7
首先说明下我的主机环境:主机:32位win7 虚拟机:VMware Workstation10.0.1 linux:红帽子centos6.4 jdk1.7 Apache-tomcat7 java环境需 ...
- Linux配置JDK1.7和Resin4.0
1.安装JDK1.7 (1)下载 官网下载路径:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-18802 ...
随机推荐
- test20190729 夏令营NOIP训练14
40+100+0=140. 基因光线 黑大帅统治古古怪界后,一直在玩一种很奇葩的游戏.在一个二维平面上,他先复制了n个小A,把他们放在不同的位置,然后射出一条ax+by+c=0的基因光线,宽度为d,即 ...
- ASCII、Unicode、UTF-8字符集编码
ASCII码 计算机内部,所有信息都是由二进制的字符串表示 每一个二进制位有“0”.“1”两种状态,因此8个二进制位可以表示256个状态,每个状态代表一个符号就是256个符号,从0000000到111 ...
- IntelliJ IDEA12的解决占用C盘C:\Users\Administrator
在安装完IntelliJ IDEA之后,默认会在windows的系统盘用户文件夹中创建配置等文件.在我只有32G的SSD盘中,怎么能让它如此,不爽呀..占用到现在都快1G了.好吧.今天把她解决了. 找 ...
- 堆优化/zkw线段树优化 dijkstra
#include <bits/stdc++.h> using namespace std; const int MAXN = 100005; const int MAXM = 200005 ...
- MySQL Innodb引擎调优
介绍: Innodb给MYSQL提供了具有提交,回滚和崩溃恢复能力的事务安全(ACID兼容)存储引擎.Innodb锁定在行级并且也在SELECT语句提供一个Oracle风格一致的非锁定读.这些特色增加 ...
- 用LinkedList和ArrayList实现自定义栈的异同
//ArrayList已连续的空间进行存储数据 //LinkedList已链表的结构存储数据 //栈 MyStark ms=new MyStark();//new 一个实现栈的类 //压栈 ...
- 使用session存储数据
@WebServlet("/reply") public class ReplyServlet extends HttpServlet { @Override protected ...
- PDB符号文件浏览工具介绍
一.SymView SymView工具用来显示符号文件中包含的符号表和符号数据.目前支持微软的Visual C/C++和C#编译器产生的DBG格式的符号文件和PDB格式的符号文件. SymView提供 ...
- 用es实现模糊搜索
Haystack为Django提供了模块化的搜索.它的特点是统一的,熟悉的API,可以让你在不修改代码的情况下使用不同的搜索后端(比如 Solr, Elasticsearch, Whoosh, Xap ...
- 自主设计BootLoader框架笔记一栏