Fix classloader for cross-plugin dependencies - #2509
Conversation
|
All plugins, except for the spring mvc one, don't have a However, this makes it hard to have a heuristic and create an automated test when to or when not to require a PluginClassLoaderRootPackageCustomizer`. |
|
I agree with you @felixbarny , we should aim to minimize extra memory usage when we can, in this case I think the benefits/cost seems worth it:
Maybe we could re-think this later with a better approach to provide cross-plugin visibility without duplication of loaded classes if we find that this memory overhead is becoming an issue. |
|
Good points. Just a question on the feasibility of making the heuristic a bit smarter: Would it be possible to detect that |
|
Good idea, I have added this case in last commit (603596c) so it simplifies things a lot for HTTP client plugins. |
|
Nice 👏 You can also remove the As the |
| try { | ||
| ClassLoader servletClassloader = servletContext.getClassLoader(); | ||
| if (servletClassloader != null) { | ||
| classLoader = servletClassloader; | ||
| fromServletContext = ServletServiceNameHelper.detectServiceInfo(JavaxServletApiAdapter.get(), servletContext, servletClassloader); | ||
| } | ||
| } catch (UnsupportedOperationException e) { | ||
| // silently ignored |
There was a problem hiding this comment.
[for reviewer] the try-catch block is similar in the Servlet adapter, thus removing duplication.
|
/test |
What does this PR do?
Fixes cross-plugin dependencies class-loading issues.
Fixing the issue is quite trivial, but the real challenge is creating a test to prevent similar issues.
Initially reported in the forum.
Checklist