org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'XXService' is expected to be of type 'XXService' but was actually of type 'com.sun.proxy.$ProxyXX'

当Spring不使用service接口时,需要开启cglib。
在spring.xml中添加

<aop:aspectj-autoproxy proxy-target-class="true"/>
如果这篇文章对你有用,麻烦关注一下本人微信公众号,关注送福利哦~
微信公众号二维码
不定期安利各种插件,编程技巧,编程思想,欢迎交流~
原文地址:https://www.cnblogs.com/aeolian/p/14917234.html