-
Notifications
You must be signed in to change notification settings - Fork 38.5k
ConfigurationClassParser does not work with scanner-provided ClassLoader [SPR-15245] #19810
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
Juergen Hoeller commented We have a rather fundamental assumption that the context-level Even if we revised the factory to generally preserve the Could you possibly configure your |
Adrian J George III commented In this case the Maybe it will help if I explain my use case. Did that make sense? |
I unfortunately don't see how we can make this consistent. As @jhoeller indicates, there is a fundamental requirement that the context class loader can see the classes that it needs to handle. This seems also a very specific arrangement of yours that we'd like to support if we can but this could easily become a rabbit hole. Thanks for the suggestion, in any case. |
Adrian J George III opened SPR-15245 and commented
When using a ClassPathBeanDefinitionScanner with a different class loader than the attached context, ConfigurationClassParser.asSourcreClass abandons the provided classloader and uses the context's loader instead. This leads to the class not being found and a failure of the context to initialize.
This line
spring-framework/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
Line 627 in 5b98a54
calls through to
spring-framework/spring-context/src/main/java/org/springframework/context/annotation/ConfigurationClassParser.java
Line 659 in 5b98a54
which uses the local class loader.
The problem can be reproduced here
https://github.com/adrianjgeorge/classloading-poc
Affects: 4.3.6
Issue Links:
The text was updated successfully, but these errors were encountered: