Spring测试的时候,出现如下报错,非常奇怪
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘org.springframework.context.annotation.internalAsyncAnnotationProcessor’ defined in class path resource [org/springframework/scheduling/annotation/ProxyAsyncConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method ‘asyncAdvisor’ threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected

Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.scheduling.annotation.AsyncAnnotationBeanPostProcessor]: Factory method ‘asyncAdvisor’ threw exception; nested exception is java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185)
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:653)
… 43 more
Caused by: java.lang.IllegalArgumentException: @EnableAsync annotation metadata was not injected
at org.springframework.util.Assert.notNull(Assert.java:201)
at org.springframework.scheduling.annotation.ProxyAsyncConfiguration.asyncAdvisor(ProxyAsyncConfiguration.java:47)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154)
… 44 more



 后来发现把配置类放在了根路径下,让配置类放在某包路径下就好了
修改前

修改后

解决Spring测试出现@EnableAsync annotation metadata was not injected相关推荐

  1. @EnableAsync annotation metadata was not injected

    今天将老的项目放在Myeclipse2015中运行时,报错了. 错误原因: 在spring的配置文件applicationContext.xml中, 配置包扫描器时, 使用了*, 想扫描所有的包; 而 ...

  2. Spring事务管理-》Spring事务管理(annotation)

    5.6 使用@Transactional 除了使用XML类型的事务管理,同时Spring也提供了Annotation类型的事务管理.如下所示: 一:Spring事务管理 =============== ...

  3. 登录用友显示java已被阻止_解决Spring Security 用户帐号已被锁定问题

    1.问题描述 主要就是org.springframework.security.authentication.LockedException: 用户帐号已被锁定这个异常,完整异常如下: [2020-0 ...

  4. Spring 测试(第一部分)

    1.Spring Testing介绍 测试是企业软件开发的一个组成部分.本章重点讨论IoC原则为单元测试 unit testing增加的价值,以及Spring框架对集成测试 integration t ...

  5. 解决spring的事物注解失效问题

    在开发过程中,spring的申明式事物可能出现,在同样的代码,在测试类中可实现事物回滚效果,正式程序中事物回滚效果失效. 这一块可能就是在事物扫描过程中@transaction注解失效的原因.只要修改 ...

  6. Spring Security系列教程解决Spring Security环境中的跨域问题

    原创:千锋一一哥 前言 上一章节中,一一哥 给各位讲解了同源策略和跨域问题,以及跨域问题的解决方案,在本篇文章中,我会带大家进行代码实现,看看在Spring Security环境中如何解决跨域问题. ...

  7. 解决Spring Boot报错Mapped Statements collection already contains value for...Error while adding the mapp

    解决Spring Boot报错Mapped Statements collection already contains value for...Error while adding the mapp ...

  8. 解决Spring下无法实时访问本地静态资源

    解决Spring下浏览器无法实时访问本地静态资源 场景1:原本地文件test.json中内容为 "1".我们通过前后端交互操作,修改test.json的内容为 "2&qu ...

  9. spring 测试 事务_Spring陷阱:事务测试被认为是有害的

    spring 测试 事务 Spring杀手级功能之一是容器内集成测试 . 尽管EJB多年来一直缺乏此功能(Java EE 6终于解决了这个问题,但是我尚未进行测试),但是Spring从一开始就允许您从 ...

最新文章

  1. EfficientNetV2震撼发布!87.3%准确率!模型更小,训练更快!谷歌大脑新作
  2. 微信公众平台开发(102) 模板消息
  3. 我眼中的JavaScript函数式编程
  4. LCA+差分【p4427】[BJOI2018]求和
  5. Boost:iostream客户端的测试程序
  6. GAP(全局平均池化层)操作
  7. ssh不能进入save方法_快速理清为什么你的redis未授权不能getshell
  8. php登录实现session记住密码,利用php实现一周之内自动登录存储机制(cookie、session、localStorage)...
  9. 华为 博士 实习_华科女博士年薪156入职华为!最新回应:在深圳也难买房…
  10. arcMap安装教程
  11. 【单片机】2.3 AT89S52的CPU
  12. 宾夕法尼亚州立大学:探索量子AI如何加速治愈癌症
  13. android 读取本地超大图片
  14. 芯片设计中的时钟与约束
  15. matlab中a2=poly(p2),插值与拟合matlab实现
  16. 经典激光雷达SLAM系统:LeGO-LOAM
  17. 我有一个计算机梦想作文500,我有一个梦想作文500字
  18. 设备管理器里“SM总线控制器”、“其他PCI桥设备”驱动有问题
  19. 物流设计大赛优秀作品_第四届广东省大学生物流设计大赛之五邑大学校园选拔赛通知...
  20. 赵小楼《天道》深度解析(69)不要执著于豆豆和书,或寻找高人。更多的是要在意内容、内容、内容。你掌握之后,你也是高人

热门文章

  1. MFC在两控件间画线
  2. epub 免费转换网站
  3. 洛谷 P2191 小Z的情书
  4. Netstat命令使用方法
  5. filebeat7.7.0相关详细配置预览- Filebeat inputs
  6. Ubuntu安装GVM-11并使用gvm-tools命令行方式通讯
  7. 计算机无法连接网络错误651,电脑宽带连接651错误的解决方法
  8. BI神器Power Query(23)-- 同一列内多重替换(3)
  9. 【django】简易视频播放功能
  10. 101. Symmetric Tree (C语言)