Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upConfigurationClassParser does not work with scanner-provided ClassLoader [SPR-15245] #19810
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? |
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: