Skip to content
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

PluginClassLoader local ClassLoader疑问 #1712

Open
lisong2010 opened this issue Dec 23, 2024 · 3 comments
Open

PluginClassLoader local ClassLoader疑问 #1712

lisong2010 opened this issue Dec 23, 2024 · 3 comments
Labels
kind/question Further information is requested

Comments

@lisong2010
Copy link

lisong2010 commented Dec 23, 2024

What do you want to ask?

您好,看了这边文章:https://developer.huawei.com/consumer/cn/forum/topic/0208129550716548036
有些疑惑,请教一下ClassLoader问题。
文章中说在执行Sermant Aspect前后去设置并清除localLoader,但是看源码并不是执行拦截方法时设置的,而是创建时候设置的(看的是2.0.0版本的源码),不知道是不是我理解错误。
Interceptor在创建时使用setLocalLoader设置了临时local ClassLoader,创建结束进行清空,这个没什么问题。但是当运行interceptor 的before、after等方法时,需要加载业务class,但是此时local loader为空,只能从Thread.currentThread().getContextClassLoader()去加载业务的class,但是有些场景(比如jdk17 ForkJoinPool Thread ContextLoader为SystemClassLoader并非spring ClassLoader),会出现加载失败,请问这种情况框架层面有解决吗,是怎么解决的?

@lisong2010 lisong2010 added the kind/question Further information is requested label Dec 23, 2024
@Issues-translate-bot
Copy link

Detect the issue's language is not English and translate it automatically.


Title: PluginClassLoader local ClassLoaderquestion

@lilai23
Copy link
Collaborator

lilai23 commented Dec 24, 2024

You can try to setlocalloader to resolve this problem

@lisong2010
Copy link
Author

Manually setlocalloader is fine, but it is more preferred to implement it at the framework level

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants