今天在spring配置文件中配置切面时,出现了以下错误:
java.lang.ClassCastException: com.sun.proxy.$Proxy11 cannot be cast to com.fresher.service.impl.AccountServiceImpl
at com.fresher.test.TestAOP.testAop(TestAOP.java:18)
错误解决方案:
在xml的配置文件的aop:config中添加属性proxy-target-class=“true”

解决Spring AOP配置错误
本文详细介绍了在Spring配置文件中设置切面时遇到的ClassCastException错误及其解决方案。通过在aop:config中添加proxy-target-class属性并设置为true,可以有效避免代理类无法转换为目标实现类的问题。
1814

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



