Spring aop报错:com.sun.proxy.$Proxyxxx cannot be cast to yyy

来源:互联网 发布:单片机实验 编辑:程序博客网 时间:2024/05/14 04:30
在使用Spring AOP时,遇到如下的错误:Exception in thread "main" java.lang.ClassCastException: com.sun.proxy.$Proxy0 cannot be cast to com.spring.test.setter.Instrumentalistat com.spring.test.setter.test.main(test.java:12)

  看报错信息,显示的是动态代理生成的类无法转换到我们自定义的实现类。
  解决办法:

  在aop:config标签中添加 proxy-target-class=”true” 即可。

阅读全文
0 0
原创粉丝点击