cast to com.session.lgj.service.impl.ServiceImpl"/>
com.sun.proxy.$Proxy2 cannot be cast to com.session.lgj.service.impl.ServiceImpl
在使用Spring AOP时,我这边是在配置事务管理的时候,遇到如下的错误:
com.sun.proxy.$Proxy2 cannot be cast to com.session.lgj.service.impl.ServiceImpl
看报错信息,显示的是动态代理生成的类无法转换到我们自定义的实现类。
解决办法:
在aop:config标签中添加 proxy-target-class=“true” 即可
如果配置文件里面没有aop:config这个标签的话,可以在下面这个标签中进行配置
<tx:annotation-driven transaction-manager=“transactionManager” proxy-target-class=“true”/>
更多推荐
com.sun.proxy.$Proxy2 cannot be cast to com.session.lgj.service.impl.ServiceImpl
发布评论