com.sun.proxy.$Proxy2 cannot be cast to com.session.lgj.service.impl.ServiceImpl

编程入门 行业动态 更新时间:2024-10-23 04:50:08

com.sun.proxy.$Proxy2 cannot be <a href=https://www.elefans.com/category/jswz/34/1743506.html style=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

本文发布于:2024-02-27 06:58:12,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1705613.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:cast   sun   proxy   session   impl

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!