-
Notifications
You must be signed in to change notification settings - Fork 41.2k
ConfigFileApplicationListener#loadPostProcessors can not load EnvironmentPostProcessor in child classLoader #26126
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
Comments
@ChenKangQiang I don't really understand what you're doing or why the child context is necessary. An application has a designated If you want support, you need to share more about your setup in the form of a small sample that shows the issue. You can do so by attaching a zip to this issue or sharing a GitHub repo url. Thanks. |
@snicoll We design such a structure,be similar to Tomcat,but follow the parental delegation mechanism. We use a |
For this specific instance, we could make |
@wilkinsona Thank you, we look forward to the results of your discussion. |
Previously, classes involved in config loading used a variety of potentially different class loaders when calling SpringFactoriesLoader. Some classes would use their own class loader and others would use null which results in SpringFactoriesLoader's class loader being used. This commit updates the config loading classes to consistently use the resource loader's class loader. Fixes spring-projectsgh-26126
My spring-boot version is 2.3.3.RELEASE. I want use spring.factories to load EnvironmentPostProcessor.

In my project, I haven a parent-child classLoader structure. ConfigFileApplicationListener.class is loaded by parent classLoader, and my environmentPostProcessorImpl is in child classloader path. The source code show that ConfigFileApplicationListener use its classloader to load EnvironmentPostProcessor. So,it can not load.
With Java SPI,it use ThreadContextClassLoader to load implementation class. Why Spring do not use ThreadContextClassLoader? Or is there any other solutions.
The text was updated successfully, but these errors were encountered: