Spring aop报错:com.sun.proxy.$Proxy cannot be cast to xxx
准备使用AOP记录所有NamedParameterJdbcTemplate操作数据时的所有日志,没想到出现这个错误,折腾了好久,终于找出原因

解决方案:在 aop-config配置添加上:
proxy-target-class="true"
贴上我的配置AOP配置:
<aop:config proxy-target-class="true">
<aop:pointcut id="pointcut" expression="execution(public * org.xx.util.JdbcUtil.*(..))"/>
<aop:aspect id="logAspect" ref="logInterceptor">
<aop:before method="before" pointcut-ref="pointcut"/>
<aop:after-returning method="afterRunning" pointcut-ref="pointcut"/>
</aop:aspect>
</aop:config>
按照博客的说法:http://blog.csdn.net/oathevil/article/details/7244694
注意:proxy-target-class属性值决定是基于接口的还是基于类的代理被创建。如果proxy-target-class 属性值被设置为true,那么基于类的代理将起作用(这时需要cglib库)。如果proxy-target-class属值被设置为false或者这个属性被省略,那么标准的JDK 基于接口的代理
Spring aop报错:com.sun.proxy.$Proxy cannot be cast to xxx的更多相关文章
- Spring aop报错:com.sun.proxy.$Proxyxxx cannot be cast to yyy
在使用Spring AOP时,遇到如下的错误: Exception in thread "main" java.lang.ClassCastException: com.sun.p ...
- Spring AOP报错
八月 01, 2016 10:08:48 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRe ...
- Spring AOP 报错org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'XXXXXX' defined in class path resource..........
完整报错如下: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'befo ...
- java后台接收json数据,报错com.alibaba.fastjson.JSONObject cannot be cast to xxx
从前台接收json封装的list数据,在后台接收时一直报错,com.alibaba.fastjson.JSONObject cannot be cast to xxx, 使用这种方式接收可以接收 @R ...
- Spring AOP报错处理 Can not set field to $Proxy 在spring中使用事物或AOP遇到的错误
[转] 解决方法: http://forum.springsource.org/showthread.php?85016-IllegalArgumentException-with-Applicati ...
- 解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element
解决eclipse spring配置报错:cvc-elt.1: Cannot find the declaration of element 'beans'.Referenced file conta ...
- Spring.之.报错:Caused by: java.lang.IllegalArgumentException: No Spring Session store is configured: set the 'spring.session.store-type' property
Spring.之.报错 No Spring Session store is configured springboot在启动的时候报如下错误: Error starting ApplicationC ...
- Spring Boot报错 MultipartException The temporary upload...
Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.se ...
- tengine2.2.3报错502的The proxy server received an invalid response from an upstream server问题处理
tengine2.2.3报错502的The proxy server received an invalid response from an upstream server问题处理 现象:访问订单的 ...
随机推荐
- 特殊集合 Stack Queue Hashtable
//Stack 干草堆集合 栈集合 先进后出 Stack st = new Stack(); //实例化 初始化 st.Push(2); //添加元素 st.Push(6); s ...
- POJ 3321 树状数组(+dfs+重新建树)
Apple Tree Time Limit: 2000MS Memory Limit: 65536K Total Submissions: 27092 Accepted: 8033 Descr ...
- Oracle中有个tkprof来格式化oracle的trace文件
1.MySQL日志文件系统的组成2.慢查询日志3.慢查询日志演示long_query_time : 设定慢查询的阀值,超出次设定值的SQL即被记录到慢查询日志,缺省值为10sslow_query_lo ...
- 您试图从目录中执行CGI、ISAPI 或其他可执行程序,但该目录不允许执行程序
您试图从目录中执行CGI.ISAPI 或其他可执行程序,但该目录不允许执行程序 本人使用WIN2003 INTERNET信息服务(IIS)管理器建立一个网站虚拟目录,结果浏览网页时出现错误,错误提示信 ...
- matlab练习程序(SUSAN检测)
matlab练习程序(SUSAN检测) SUSAN算子既可以检测角点也可以检测边缘,不过角点似乎比不过harris,边缘似乎比不过Canny.不过思想还是有点意思的. 主要思想就是:首先做一个和原图像 ...
- Android课程---final关键字
final 在Java中声明属性.方法和类时,可使用关键字final来修饰. final变量即为常量,只能赋值一次: final方法不能被子类重写: final ...
- Window7 驱动编程环境配置
1. 安装VS2010,WDK7.60(GRMWDK_EN_7600_1) 2. 新建VC 控制台项目(选择为空项目) 3. 新建项目配置“driver” ,点击下拉按钮-点击(配置管理器) 输 ...
- 【iCore3 双核心板】例程二:读取arm按键状态
实验指导书及代码包下载: http://pan.baidu.com/s/1sjrHnM9 iCore3 购买链接: https://item.taobao.com/item.htm?id=524229 ...
- Visual Studio中删除所有空行
解决方法如下: 使用快捷键Ctrl+H,显示查找和替换视图菜单 Find what(查找内容):^:b*$\n Replace with(替换为):[Empty] (空字符串,什么都不用填) Look ...
- shell读取文件每行,并执行命令
#!/bin/bash while read line do $line & done < /path/filename