600字范文,内容丰富有趣,生活中的好帮手!
600字范文 > The bean ‘Xxx‘ could not be injected as a ‘Xxx‘ because it is a JDK dynamic proxy that implements:x

The bean ‘Xxx‘ could not be injected as a ‘Xxx‘ because it is a JDK dynamic proxy that implements:x

时间:2023-10-12 09:35:14

相关推荐

The bean ‘Xxx‘ could not be injected as a ‘Xxx‘ because it is a JDK dynamic proxy that implements:x

完成错误信息如下:

***************************APPLICATION FAILED TO START***************************Description:The bean 'executeServiceImpl' could not be injected as a 'cn.func.server.service.execute.impl.ExecuteServiceImpl' because it is a JDK dynamic proxy that implements:cn.func.server.service.execute.ExecuteServiceAction: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.

使用ExecuteServiceImpl的代码:

@Autowiredprivate ExecuteServiceImpl executeService;

出现此错误的原因是注入ExecuteServiceImpl时使用的类型不能使用ExecuteServiceImpl而是应该使用ExecuteServiceImpl的被实现接口ExecuteService。

修改后代码:

@Autowiredprivate ExecuteService executeService;

也可以根据提示修改为CGLib动态代理,详情原因可以查看另一篇文章中的错误演示。

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。