首页 > 解决方案 > 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>

标签: javaspring

解决方案


对,问题出在JDK16…

最后,我将 de JDK 16 更改为该项目的 JDK 14 并且正在工作,也许这对将来的某人有所帮助。

对不起我的英语。


推荐阅读