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
Problem Description
When I was writing code today, I added a new functional module. After writing the code, the startup project could not be started, and an error like this was reported:
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
Resolution process
The literal meaning is that it should be an injection error. After checking the related injections over and over again, no problem was found. Then I went to Baidu and found the following solution:
Add @EnableTransactionManagement(proxyTargetClass = true) in the startup class