使用spring遇到"BeanNotOfRequiredTypeException......but was actually of type [com.sun.proxy.$Proxy18]"异常

╰半夏微凉° 2022-07-13 15:55 255阅读 0赞

问题描述:

在使用aspectJ申明事务管理时出现的异常

org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named ‘accountServiceImpl’ must be of type [com.cc.spring.demo4.AccountServiceImpl],but was actually of type [com.sun.proxy.$Proxy18]

解决方法:

出现该异常是由于使用了默认的jdk的自动动态代理,需要在 ,即表示使用AspectJ的支持。

发表评论

表情:
评论列表 (有 0 条评论,255人围观)

还没有评论,来说两句吧...

相关阅读