***************************
APPLICATION FAILED TO START
***************************
Description:
The bean 'devicePermissionUpdateThread' could not be injected as a 'com.cloume.smartedu.service.impl.DevicePermissionUpdateThread' because it is a JDK dynamic proxy that implements:
com.cloume.smartedu.service.IDevicePermissionUpdateThread
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.
今天编写代码加入@Async注解时候遇到这个问题,网上大部分解决方案是加入在配置类加入@EnableAspectJAutoProxy(proxyTargetClass = true)。我尝试了下不行。我遇到的问题是类被实现了调用接口,同时在其他类中该方法也被通过@autowired注入了。
把第一张图中的代码去掉就可以,在spingboot加载时候这样会冲突。