编写切面,并在ApplicationContest.xml 中相关AOP及切面的配置完全正确的情况下,运行报错如下:

Exception in thread "main" org.springframework.beans.factory.BeanNotOfRequiredTypeException: Bean named 'usd' is expected to be of type 'com.yusys.service.UserServiceImpl' but was actually of type 'com.sun.proxy.$Proxy2'
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:378)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1086)
at com.yusys.test.Test.main(Test.java:14)

解决办法是,在AppliacationContext.xml中添加 <aop:aspectj-autoproxy  proxy-target-class="true"/> 这样的配置即可解决

多次搜索获得的一个解释是:如果切入点切入的是实现类需要在spring的配置文件中加上<aop:aspectj-autoproxy proxy-target-class="true"></aop:aspectj-autoproxy>标签,代表代理的实现类而非基于接口代理

最新文章

  1. Android笔记——Handler Runnable与Thread的区别
  2. jQueryNotes仿QQ空间添加标记
  3. [OpenCVsharp]利用指针实现高速访问像素RGB值
  4. zipalign内存对齐优化
  5. 图书简介:Spring Batch批处理框架
  6. php win主机下实现ISAPI_Rewrite伪静态
  7. 如何在django的filter中传递字符串变量作为查询条件(动态改变查询条件)
  8. 基于HBase0.98.13搭建HBase HA分布式集群
  9. Linux——搭建PHP开发环境第三步:mysql
  10. ubuntu14.04 为Firefox安装flash插件
  11. 写一个兼容性比较好的拖拽DEMO
  12. java中用正則表達式推断中文字符串中是否含有英文或者数字
  13. 过程 : 概念 : 结构 jobbox jobPost
  14. 传输控制协议(TCP) -- TCP状态转换图
  15. sqlmap --tamper 绕过WAF脚本分类整理
  16. 如何在Linux下修改Mysql的用户(root)密码
  17. Educational Codeforces Round 42 (Rated for Div. 2) E. Byteland, Berland and Disputed Cities
  18. Java中替换字符串中特殊字符+ 20150921
  19. Redis作为缓存服务器
  20. P1491 集合位置

热门文章

  1. 解决方法:Could not load file or assembly &#39;WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35&#39; or one of its dependencies.
  2. python去除字符串中的特殊字符(爬虫存储数据时会遇到不能作为文件名的字符串)
  3. 虚拟机下修改ip配置
  4. Python之字符(2)
  5. 操作系统OS - Zip Bomb
  6. 4.ORM框架的查询
  7. 吴裕雄 Bootstrap 前端框架开发——Bootstrap 表格:在 &lt;tbody&gt; 内添加斑马线形式的条纹 ( IE8 不支持)
  8. C. Swap Letters 01字符串最少交换几次相等
  9. TensorFlow样例一
  10. 【PAT甲级】1005 Spell It Right (20 分)