准备使用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的更多相关文章

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

    在使用Spring AOP时,遇到如下的错误: Exception in thread "main" java.lang.ClassCastException: com.sun.p ...

  2. Spring AOP报错

    八月 01, 2016 10:08:48 下午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRe ...

  3. 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 ...

  4. java后台接收json数据,报错com.alibaba.fastjson.JSONObject cannot be cast to xxx

    从前台接收json封装的list数据,在后台接收时一直报错,com.alibaba.fastjson.JSONObject cannot be cast to xxx, 使用这种方式接收可以接收 @R ...

  5. Spring AOP报错处理 Can not set field to $Proxy 在spring中使用事物或AOP遇到的错误

    [转] 解决方法: http://forum.springsource.org/showthread.php?85016-IllegalArgumentException-with-Applicati ...

  6. 解决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 ...

  7. 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 ...

  8. Spring Boot报错 MultipartException The temporary upload...

    Spring Boot报错:尤其是在处理Ribbon这类接口调用型的负载均衡组件,常见问题 ERROR o.a.c.c.C.[.[.[.[dispatcherServlet] - Servlet.se ...

  9. 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问题处理 现象:访问订单的 ...

随机推荐

  1. Bootstrap 4上线啦!!!

    Bootstrap 官方于 2015 年 8 月 19 日发布了其最新版本 Bootstrap v4.0.0-alpha. Bootstrap 4 的开发是一项浩大的工程,将近一年的开发,几乎是对整个 ...

  2. 多态(Java)

    一.多态 1.什么是多态? 解析:不同的对象对于同一个操作,做出的响应不同 具有表现多种形态的能力的特征 2.使用多态的优点 解析:为了实现统一调用 一个小例子:<父类类型作为参数> 父类 ...

  3. Mysql bench执行sql语句批量操作数据所遇到的问题

    一.错误 rror Code: 1175. You are using safe update mode and you tried to update a table without a WHERE ...

  4. [LintCode] Shape Factory 形状工厂

    Factory is a design pattern in common usage. Implement a ShapeFactory that can generate correct shap ...

  5. [CareerCup] 18.2 Shuffle Cards 洗牌

    18.2 Write a method to shuffle a deck of cards. It must be a perfect shuffle—in other words, each of ...

  6. HDU2067/HDU1267 /HDU1130 递推

    小兔的棋盘 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submi ...

  7. HTTP协议 (五) 代理

    HTTP协议 (五) 代理 阅读目录 什么是代理服务器 Fiddler就是个典型的代理 代理作用一:FQ 代理作用二:匿名访问 代理作用三:通过代理上网 代理作用四:通过代理缓存,加快上网速度 代理作 ...

  8. CentOS 安装

    选择选择启动介质 Install or upgrade an existing system: 安装或升级现有的系统 install system with basic video driver: 安 ...

  9. 织梦5.7 TAG、标题、栏目以及keywords长度字符数限制修改

    织梦5.7 TAG.标题.栏目以及keywords长度字符数限制修改[图文]   标签: 织梦关键词长度修改 织梦tag长度修改 织梦标题长度修改 织梦栏目长度限制修改 织梦修改 分类: 技术操作   ...

  10. 织梦DEDECMS网站后台安全检测提示 加一个开关

    1.进入后台后,点击 系统->系统基本参数->添加变量: 变量名称:cfg_safecheck_switch 变量值:N 变量类型:布尔(Y/N) 参数说明:启用安全监测系统: 2.找到系 ...