Description:The bean ‘orderDetailServiceImpl’ could not be injected as a ‘cn.fpl1116.xile.service.impl.OrderDetailServiceImpl’ because it is a JDK dynamic proxy that implements:cn.fpl1116.xile.service.OrderDetailService
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.
Process finished with exit code 1
问题描述
今天在写代码的时候,新增了一个功能模块,写完代码之后,启动项目无法启动,报出了这么一行的错误:
Description:
The bean 'orderDetailServiceImpl' could not be injected as a 'cn.fpl1116.xile.service.impl.OrderDetailServiceImpl' because it is a JDK dynamic proxy that implements:
cn.fpl1116.xile.service.OrderDetailService
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.
Process finished with exit code 1
解决过程
字面意思看应该是注入的错误,就在排查相关的注入,排查了一遍又一遍之后,并没有发现问题,之后就百度,发现了如下的解决方法:
在启动类中添加@EnableTransactionManagement(proxyTargetClass = true)