开发者社区> 问答> 正文

spring使用各种注解报错 ?报错

使用Spring框架时,使用注解就报错.

 Caused by: 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:\Eclipse Luna4.4\eclipse\workspace\testWeb\build\classes\test\A.class]; nested exception is java.lang.IllegalArgumentException
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:56)
    at org.springframework.core.type.classreading.SimpleMetadataReaderFactory.getMetadataReader(SimpleMetadataReaderFactory.java:80)
    at org.springframework.core.type.classreading.CachingMetadataReaderFactory.getMetadataReader(CachingMetadataReaderFactory.java:102)
    at org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider.findCandidateComponents(ClassPathScanningCandidateComponentProvider.java:266)
    ... 24 more
Caused by: java.lang.IllegalArgumentException
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.asm.ClassReader.<init>(Unknown Source)
    at org.springframework.core.type.classreading.SimpleMetadataReader.<init>(SimpleMetadataReader.java:53)
    ... 27 more

事情是这样的,本来使用eclipse4.6.1版本的,使用注释没有问题,后来写SpringMVC配置ok后启动tomcat就报错(不用注释),我就重新下了个4.4.2版本的eclipse,运行可以通过,但是现在发现,这个版本的eclipse使用注解就报错,包括注解注入、组件扫描等.请问这到底是什么问题,?

代码+jar包都是一样的.

展开
收起
爱吃鱼的程序员 2020-06-22 23:29:32 606 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    查了半天.发现是jdk与Spring不兼容导致的.我的是jdk8,用Spring4就解决问题了.遇到相同问题的兄弟不妨看看咯.避免去浪费不必要的时间

    自问自答自采纳

    还一个问题.就是上文所说的注释是注解--.搞混淆了.

    2020-06-22 23:29:51
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
云栖社区特邀专家徐雷Java Spring Boot开发实战系列课程(第20讲):经典面试题与阿里等名企内部招聘求职面试技巧 立即下载
微服务架构模式与原理Spring Cloud开发实战 立即下载
阿里特邀专家徐雷Java Spring Boot开发实战系列课程(第18讲):制作Java Docker镜像与推送到DockerHub和阿里云Docker仓库 立即下载

相关实验场景

更多