java - Spring框架在Netbeans中与JDK javac 16.0.2一起使用吗?
问题描述
Exception in thread "main"
org.springframework.beans.factory.BeanDefinitionStoreException: I/O
failure during classpath scanning; nested exception is
org.springframework.core.NestedIOException: ASM ClassReader failed to
parse class file - probably due to a new Java class file version that
isn't supported yet: class path resource
[springanotaciones/ComercialExp.class]; nested exception is
java.lang.IllegalArgumentException: Unsupported class file major
version 60
package springanotaciones;
import org.springframework.context.support.ClassPathXmlApplicationContext;
public class play {
public static void main(String[] args) {
ClassPathXmlApplicationContext contexto = new
ClassPathXmlApplicationContext("applicationContext.xml");
Empleado pipi = contexto.getBean("comercial", Empleado.class);
System.out.println(pipi.setInforme());
}
}
package springanotaciones;
public interface Empleado {
public String setTarea();
public String setInforme();
}
package springanotaciones;
import org.springframework.stereotype.Component;
@Component("comercial")
public class ComercialExp implements Empleado {
@Override
public String setTarea() {
return"vender y vernder";
}
@Override
public String setInforme() {
return"El comercial genero un informe";
}
}
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.1.xsd
">
<context:component-scan base-package="springanotaciones"></context:component-scan>
</beans>
解决方案
对,问题出在JDK16…
最后,我将 de JDK 16 更改为该项目的 JDK 14 并且正在工作,也许这对将来的某人有所帮助。
对不起我的英语。
推荐阅读
- java - JavaFX listview init() 方法
- android - Android 活动生命周期 - onStop() 之后和 onDestory() 被调用时会发生什么
- azure-devops - 将使用 CICD 的项目迁移到衍生流程
- javascript - 从对象数组中删除属性
- python - 为行组添加不同的缺失日期
- android - 构建签名APK Android时出现Proguard错误
- java - 如何提高 JDK 8 nashorn 引擎性能?
- npm - 在 monorepo 中的多个应用程序之间共享组件时如何处理共享依赖项
- linux - 向远程 tcp-client 发送数据的 Linux 命令
- c# - 找到一个特定的单元格值并在之后删除行excel c#