because it is a JDK dynamic proxy that implements


***************************
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加載時候這樣會衝突。

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章