java.lang.IllegalArgumentException: Can not set XXX to com.sun.proxy.$Proxy28

spring项目启动报错java.lang.IllegalArgumentException: Can not set XXX to com.sun.proxy.$Proxy28:

初次使用spring MVC注解模式进行事务控制

由于spring AOP动态代理默认是通过接口,所以注入事务层的地方都要通过接口进行注入,如果通过实现类进行注入就会报这个错

有人说可以进行配置,然后也可以支持实体类的事务层注入,在配置

 

<tx:annotation-driven transaction-manager="transactionManager"/>
中加入
proxy-target-class="true"
即可

猜你喜欢

转载自aoyouzi.iteye.com/blog/2301346