错误信息:
org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ‘userServiceImp’ is expected to be of type ‘com.xxx.service.UserServiceImp’ but was actually of type ‘com.sun.proxy.$Proxy18’
错误描述:在使用Spring事务机制时,出现这样的原因是:代理对象混乱,需要指定用CGLIB的方式代理。
解决方法:
在配置文件或者配置类上指定为CGLIB代理
xml:
<aop:aspectj-autoproxy proxy-target-class="true"></aop:aspectj-autoproxy>