Spring Aop 报错 ...but was actually of type 'com.sun.proxy.$Proxy**'的解决方案

刚用Spring Aop通过切面引入新的功能,一个简单的Demo,总是报错

错误描述:Caused by: org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named '****' is expected to be of type '****' but was actually of type 'com.sun.proxy.$Proxy**'
网上查了说了Spring aop代理混用的问题

解决方案是在你的spring-config.xml文件中,把<aop:aspectj-autoproxy>改为

<aop:aspectj-autoproxy proxy-target-class="true"/>

转载来源:but was actually of type 'com.sun.proxy.$Proxy**'的两种解决方法

猜你喜欢

转载自blog.csdn.net/weixin_40672761/article/details/83861487