-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
如果在插件中使用装饰模式增强、并非jdk动态代理时,会导致com.baomidou.mybatisplus.core.toolkit.PluginUtils#realTarget获取实际处理对象失败 #6183
Comments
你自己的东西让别人怎么取? |
至少有2种方式: 1、简单粗暴,直接判断target是否包含h属性。这样就算是使用装饰模式,被装饰对象属性名如果为h,同样可以获取到真实对象:
2、提供获取原始对象接口:如果使用装饰模式,装饰类再实现该接口,返回真实对象;
方法总比困难多 |
问题解决了吗?我将关闭本issue,如需要可以reopen |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
如果在插件中使用装饰模式增强、并非jdk动态代理时,会导致com.baomidou.mybatisplus.core.toolkit.PluginUtils#realTarget获取实际处理对象失败
当前使用版本
mybatisplus所有版本
当前环境信息
Java8 + Mysql5.7
描述bug现象
之前使用mybatis,自定义了很多插件,插件使用装饰模式增强,并非JDK动态代理。
最近打算升级到mybatis-plus,发现在com.baomidou.mybatisplus.core.toolkit.PluginUtils#realTarget处报错,此方法并未分离出来实际对象。
提供问题复现步骤
拦截器示例:使用装饰模式增强StatementHandler.prepare
异常信息:
实际原因:
com.baomidou.mybatisplus.core.toolkit.PluginUtils#realTarget,只有在入参target是JDK代理对象时,才会执行获取实际对象逻辑。
The text was updated successfully, but these errors were encountered: