在写Spring AOP 的时候,发现报了个错:org.springframework.beans.factory.BeanNotOfRequiredTypeException……
报错时我的注入方式是类注入
@Autowired
private PerformanceImpl performanceImpl;//类注入改成接口注入方式: @Autowired
private Performance performance;//接口注入就可以通过测试了,原因是Spring的动态代理机制只支持接口注入
本文探讨了在使用Spring AOP时遇到的BeanNotOfRequiredTypeException错误,并介绍了如何通过将类注入更改为接口注入来解决此问题。文章解释了Spring的动态代理机制为何仅支持接口注入。
2345

被折叠的 条评论
为什么被折叠?



