更新时间:2023-09-15 15:37:16
抛出异常的类使用此代码检查Java版本:
The class that's throwing the exception is using this code to check for Java version:
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;
}
}
因此,当Spring 2.5首次发布时,代码并没有假设它将在晚于1.7的Java版本中运行。对于Java 8及更高版本,上面的代码将采用默认的1.4版本。因此,注释部分会抱怨。
So, when Spring 2.5 was first released, the code didn't assume it will be run in a Java version that's later than 1.7. For Java 8 and beyond, the code above will assume default 1.4 version. Because of this, the annotations part will complain.
我认为您需要升级Spring版本或使用Java 7. Spring 2.5已经被淘汰了很长一段时间了。
I think you either need to upgrade your Spring version or use Java 7. Spring 2.5 has been EOLed for quite some time now, anyway.