-
Notifications
You must be signed in to change notification settings - Fork 38.5k
ConfigurationClassEnhancer does not use correct ClassLoader when called multiple times #33024
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
This is caused by the AttemptLoad seems to load a class with the same name irrespective of the specified ClassLoader. Maybe we need to conditionally set it to false depending on the ClassLoader arrangement. |
I guess we're setting |
Since we are primarily talking about reload scenarios, maybe we should simply set AttemptLoad to false if the current configuration class passes In general, cleanly differentiating between pre-loaded classes and pre-defined classes is impossible for an arbitrary target ClassLoader. The ClassLoader API is trying hard to treat those the same, with only the |
A modified test case where the custom ClassLoader implements |
Sounds good. Once that's in I can update Boot and test the read sample again. |
Actually we already implement that method so we may not need any Boot changes. |
I would expect Boot's |
Tested and all looks good 👍 |
Discovered whilst looking into spring-projects/spring-boot#39733
The following test will pass with Spring Framework 5.3.36 but fail with Spring Framework 6.0.12:
I haven't managed to exactly track down why, but I suspect that b31a158 might have introduced the problem. Perhaps this key?
The text was updated successfully, but these errors were encountered: