首页 > 编程语言 > 详细

spring-boot 启动时候 出现异常:The bean 'xxx' could not be injected as a 'xx.xxxx' because it is a JDK dynamic proxy that implements:

时间:2018-03-28 16:03:57      阅读:5703      评论:0      收藏:0      [点我收藏+]
The bean ‘xxxService‘ could not be injected as a ‘AaaXxxService‘ because it is a JDK dynamic proxy that implements: 


Action:  
  
Consider injecting the bean as one of its interfaces or forcing the use of CGLib-based proxies by setting proxyTargetClass=true on @EnableAsync and/or @EnableCaching.

查了半天,原来是因为把 @Autowired 换成了 @Resource

以前的代码是

@Autowired
private AaaXxxService xxxService;

修改后的代码

@Resource
private AaaXxxService xxxService;

这样就报错了。。

主要问题是名字和类名不一样导致 Resource 注入失败,但是刚好又有一个 xxxService 同名的类存在,就会报这个错误

解决方法就是 名字改成和类一样

@Resource
private AaaXxxService aaaXxxService;

 

spring-boot 启动时候 出现异常:The bean 'xxx' could not be injected as a 'xx.xxxx' because it is a JDK dynamic proxy that implements:

原文:https://www.cnblogs.com/romicLord/p/8664198.html

(0)
(7)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!