在学习Spring框架中的注解时,第一次测试就出现了这个问题,百思不得其解 最后发现是JDK和Spring的版本不匹配,我的Spring框架版本为5.2.6 仅仅支持到JDK15 而我的是JDK16,由此出现了问题
- Spring Framework 5.3.x: JDK 8-17 (expected)
- Spring Framework 5.2.x: JDK 8-15 (expected)
- Spring Framework 5.1.x: JDK 8-12
- Spring Framework 5.0.x: JDK 8-10
- Spring Framework 4.3.x: JDK 6-8
本来准备再下载一个JDK8,突然发现在File-Setting-Build, Execution... - Java Compiler 中能够调整Project bytecode version 将这里由16修改为15 问题得以解决
错误:org.springframework.beans.factory.BeanDefinitionStoreException: Failed to read candidate component class: file [D:\java学习\spring5_demo3\out\production\spring5_demo3\com\spring5\service\UserService.class]; 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: file [D:\java学习\spring5_demo3\out\production\spring5_demo3\com\spring5\service\UserService.class]; nested exception is java.lang.IllegalArgumentException: Unsupported class file major version 60
|