…… are only available on JDK 1.5 and higher 错误(spring 的jdk版本检测在jdk 8下的修订)
正常方法
用更高的版本,因为spring向下兼容。
我公司需求的方法(真 迟早跑路)
1、在项目中创建一个package为org.springframework.core
2、在该package下面新建JdkVersion.java,内容如下:
package org.springframework.core;
public abstract class JdkVersion {
public static final int JAVA_13 = 0;
public static final int JAVA_14 = 1;
public static final int JAVA_15 = 2;
public static final int JAVA_16 = 3;
public static final int JAVA_17 = 4;
//for jre 1.8
public static final int JAVA_18 = 5;
private static final String javaVersion = System
.getProperty("java.version");
private static final int majorJavaVersion;
public static String getJavaVersion() {
return javaVersion;
}
public static int getMajorJavaVersion() {
return majorJavaVersion;
}
public static boolean isAtLeastJava14() {
return true;
}
public static boolean isAtLeastJava15() {
return getMajorJavaVersion() >= 2;
}
public static boolean isAtLeastJava16() {
return getMajorJavaVersion() >= 3;
}
static {
//for jre 1.8
if (javaVersion.indexOf("1.8.") != -1) {
majorJavaVersion = 5;
}else if (javaVersion.indexOf("1.7.") != -1) {
majorJavaVersion = 4;
} else if (javaVersion.indexOf("1.6.") != -1) {
majorJavaVersion = 3;
} else if (javaVersion.indexOf("1.5.") != -1) {
majorJavaVersion = 2;
} else {
majorJavaVersion = 1;
}
}
}
3、到项目的WEB-INF/classes 下面找到对应的package中的JdkVersion.class文件
4、将项目中的spring-core-2.5.6.jar拷贝出来打开,然后将JdkVersion.class替换jar包中的该文件。
5、将修改后的spring-core-2.5.6.jar再覆盖到项目中。
…… are only available on JDK 1.5 and higher 错误(spring 的jdk版本检测在jdk 8下的修订)的更多相关文章
- …… are only available on JDK 1.5 and higher 错误
"C:\Program Files\Java\jdk1.8.0_73\bin\java" -ea -Didea.test.cyclic.buffer.size=1048576 &q ...
- zookeeper_service 出错 ........... are only available on JDK 1.5 and higher
出错:: ContextLoader:215 ERROR - Context initialization failed org.springframework.beans.factory.Bean ...
- Spring 3 调度器示例 —— JDK 定时器和 Quartz 展示
Spring框架提供了执行和调度任务的抽象,支持线程池或者在应用服务器环境中代理给CommonJ. Spring也集成了支持使用JDK Timer和Quartz调度库提供的Quartz Schedul ...
- 【转载】Spring AOP详解 、 JDK动态代理、CGLib动态代理
Spring AOP详解 . JDK动态代理.CGLib动态代理 原文地址:https://www.cnblogs.com/kukudelaomao/p/5897893.html AOP是Aspec ...
- 【原创】大叔经验分享(16)Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
今天尝试运行一个古老的工程,配置好之后编译通过,结果运行时报错: org.springframework.beans.factory.BeanDefinitionStoreException: Une ...
- [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher 问题--MyEclipse设置JDK版本
org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML doc ...
- Target JRE version (1.7.0_79) does not match project JDK version (java version "1.8.0_171"), will use sources from JDK: 1.7
IDEA不会自动匹配系统的JDK环境.如果在IDEA里面没有配置JDK,那么运行程序时就会报错 之前碰到这个问题卡了一下 顺手记录一下 出现此错误说明IDE中配置的jdk版本和你使用的jdk版本不一致 ...
- spring 2.5.6 错误:Context namespace element 'component-scan' and its parser class [org.springframework.context.annotation.ComponentScanBeanDefinitionParser] are only available on JDK 1.5 and higher
在运行一个第三方公司交付的项目的时候, 出现: Caused by: java.lang.IllegalStateException: Context namespace element 'annot ...
- AnnotationConfigBeanDefinitionParser are only available on JDK 1.5 and higher
報錯: org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML ...
随机推荐
- Python-字符串及列表操作-Day2
1.数据类型 1.1 变量引出数据类型 变量:用来记录状态变量值的变化就是状态的变化,程序运行的本质就是来处理一系列的变化 1.2 五大基本数据类型: 数字 字符串 列表 元组 字典 1.2.1 数字 ...
- Docker学习笔记 - Docker的简介
传统硬件虚拟化:虚拟硬件,事先分配资源,在虚拟的硬件上安装操作系统,虚拟机启动起来以后资源就会被完全占用. 操作系统虚拟化:docker是操作系统虚拟化,借助操作系统内核特性(命名空间.cgroups ...
- jQuery serialize()方法获取不到数据,alert结果为空
网上查找,问题可能是 id有重复 经排查,没有发现重复id 解决方案 form表单中每个input框都没有name属性,添加name属性即可 若name属性与jQuery的关键字有冲突,也可导致该问题 ...
- leetcode算法:Trim a Binar Search Tree
Given a binary search tree and the lowest and highest boundaries as L and R, trim the tree so that a ...
- Django知识总结
一.什么是web框架? 框架,即framework,特指为解决一个开放性问题而设计的具有一定约束性的支撑结构,使用框架可以帮你快速开发特定的系统,简单地说,就是你用别人搭建好的舞台来做表演. web应 ...
- springboot--mybatis--pagehelper分页整合不起作用
今天配置pagehelper,在pom文件中都使用的最新版本jar包,步骤都没问题,之后才发现是包的问题. 有问题:分页配置不起作用 <dependency> <groupId> ...
- div中的内容超过容器宽度的问题
问题描述: <div class="category"> <div class="column-a">排名</div> ...
- [LeetCode] Set Intersection Size At Least Two 设置交集大小至少为2
An integer interval [a, b] (for integers a < b) is a set of all consecutive integers from a to b, ...
- [LeetCode] Maximum Binary Tree 最大二叉树
Given an integer array with no duplicates. A maximum tree building on this array is defined as follo ...
- openSUSE虚拟机安装并连接Xshell