Aop配置时候的一些问题
编写切面,并在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>标签,代表代理的实现类而非基于接口代理
最新文章
- Android笔记——Handler Runnable与Thread的区别
- jQueryNotes仿QQ空间添加标记
- [OpenCVsharp]利用指针实现高速访问像素RGB值
- zipalign内存对齐优化
- 图书简介:Spring Batch批处理框架
- php win主机下实现ISAPI_Rewrite伪静态
- 如何在django的filter中传递字符串变量作为查询条件(动态改变查询条件)
- 基于HBase0.98.13搭建HBase HA分布式集群
- Linux——搭建PHP开发环境第三步:mysql
- ubuntu14.04 为Firefox安装flash插件
- 写一个兼容性比较好的拖拽DEMO
- java中用正則表達式推断中文字符串中是否含有英文或者数字
- 过程 : 概念 : 结构 jobbox jobPost
- 传输控制协议(TCP) -- TCP状态转换图
- sqlmap --tamper 绕过WAF脚本分类整理
- 如何在Linux下修改Mysql的用户(root)密码
- Educational Codeforces Round 42 (Rated for Div. 2) E. Byteland, Berland and Disputed Cities
- Java中替换字符串中特殊字符+ 20150921
- Redis作为缓存服务器
- P1491 集合位置
热门文章
- 解决方法:Could not load file or assembly &#39;WebGrease, Version=1.5.1.25624, Culture=neutral, PublicKeyToken=31bf3856ad364e35&#39; or one of its dependencies.
- python去除字符串中的特殊字符(爬虫存储数据时会遇到不能作为文件名的字符串)
- 虚拟机下修改ip配置
- Python之字符(2)
- 操作系统OS - Zip Bomb
- 4.ORM框架的查询
- 吴裕雄 Bootstrap 前端框架开发——Bootstrap 表格:在 <;tbody>; 内添加斑马线形式的条纹 ( IE8 不支持)
- C. Swap Letters 01字符串最少交换几次相等
- TensorFlow样例一
- 【PAT甲级】1005 Spell It Right (20 分)