博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
cannot get proxied via CGLIB
阅读量:5743 次
发布时间:2019-06-18

本文共 2051 字,大约阅读时间需要 6 分钟。

hot3.png

改了一些代码,启动时有个INFO的提示,虽说是INFO提示,但以前没见过;

2017-09-27 09:49:46,982 INFO (o.s.a.f.CglibAopProxy:) - Final method [private final void xxxx.xxx.AbstractDalService.baseValid(xxx.xxx.BasicDto)] cannot get proxied via CGLIB: Calls to this method will NOT be routed to the target instance and might lead to NPEs against uninitialized fields in the proxy instance.

于是打开CglibAopProxy类,看了一下原因;

/**	 * Checks for final methods on the given {@code Class}, as well as package-visible	 * methods across ClassLoaders, and writes warnings to the log for each one found.	 */	private void doValidateClass(Class
proxySuperClass, ClassLoader proxyClassLoader, Set
> ifcs) { if (proxySuperClass != Object.class) { Method[] methods = proxySuperClass.getDeclaredMethods(); for (Method method : methods) { int mod = method.getModifiers(); if (!Modifier.isStatic(mod)) { if (Modifier.isFinal(mod)) { if (implementsInterface(method, ifcs)) { logger.warn("Unable to proxy interface-implementing method [" + method + "] because " + "it is marked as final: Consider using interface-based JDK proxies instead!"); } logger.info("Final method [" + method + "] cannot get proxied via CGLIB: " + "Calls to this method will NOT be routed to the target instance and " + "might lead to NPEs against uninitialized fields in the proxy instance."); } else if (!Modifier.isPublic(mod) && !Modifier.isProtected(mod) && !Modifier.isPrivate(mod) && proxyClassLoader != null && proxySuperClass.getClassLoader() != proxyClassLoader) { logger.info("Method [" + method + "] is package-visible across different ClassLoaders " + "and cannot get proxied via CGLIB: Declare this method as public or protected " + "if you need to support invocations through the proxy."); } } } doValidateClass(proxySuperClass.getSuperclass(), proxyClassLoader, ifcs); } }

这就好改了嘛,将AbstractDalService.baseValid方法改成 static的就ok了,提示消失;

TODO

下来仔细分析一下,由其是AOP那么事;

转载于:https://my.oschina.net/u/168669/blog/1543968

你可能感兴趣的文章
CentOs7.3 搭建 RabbitMQ 3.6 Cluster 集群服务与使用
查看>>
Brackets 小技巧 | IDE
查看>>
CSS揭秘之《边框内圆角》
查看>>
【218天】黑马程序员27天视频学习笔记【Day20-21复习脑图】
查看>>
JavaScript 中基于 swagger-decorator 的自动实体类构建与 Swagger 接口文档生成
查看>>
js数据结构之栈
查看>>
Elastic Search快速上手(4):细节补充
查看>>
【全栈React】第29天: 持续集成
查看>>
合并两个已排序的链表
查看>>
ArcGIS水文分析实战教程(8)水库库容计算
查看>>
js面向对象浅谈(三)
查看>>
Webpack 的核心开发者 Sean Larkin 入驻 SegmentFault 了
查看>>
现阶段选择ArcMap还是ArcGIS Pro
查看>>
每日一题:五 特别的数字
查看>>
Windows 下用php exec执行git pull遇到的问题及解决方案
查看>>
基于socket.io实现的一对一聊天服务器和客户端
查看>>
CSS进阶——绝对定位元素的宽高是如何定义的
查看>>
Mock.js使用
查看>>
进程的Binder线程池工作过程
查看>>
Unity项目使用静态图片做背景
查看>>