本文主要是介绍【BugFix】Injection of autowired dependencies failed;Could not autowire field AOP代理类 + @Autowired注入 报错,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
1.现象
项目启动不了,报 Could not autowire field, No qualifying bean of type [xxx] found for dependency
2.原因
autowire自动装配的字段类型声明的是实现类 xxximp extends xxx
由于xxx类命中了切面,导致spring暴露出来的是代理类,而JDK动态代理生成的对象 的类是面向接口的,对于实现类无感知,
所以报错
3.解决方案
依赖字段的类型 面向接口编程,类型改为对应接口
这篇关于【BugFix】Injection of autowired dependencies failed;Could not autowire field AOP代理类 + @Autowired注入 报错的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!