Spring AOP两个错误解决
时间:2019-09-09 10:27:34
收藏:0
阅读:575
1.Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘sword‘ defined in class path resource [Demo/applicationContext.xml]: BeanPostProcessor before instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanCreationException:
#问题解决:缺少了 aspectjweaver.jar 包,下载地址
#顺便附上另一个有可能缺少的包:aopalliance-1.0.jar,下载地址
2.Exception in thread "main" java.lang.ClassCastException: class com.sun.proxy.$Proxy11 cannot be cast to class XXX
(com.sun.proxy.$Proxy11 and Demo.BraveKnight are in unnamed module of loader ‘app‘)
#报错信息:动态代理生成的类无法转换到我们自定义的实现类
#问题解决:在aop:config标签中添加 proxy-target-class="true" 即可。
原文:https://www.cnblogs.com/Ravenzzz/p/11489698.html
评论(0)