spring-projects / spring-framework

Spring Framework
https://spring.io/projects/spring-framework
Apache License 2.0
56.75k stars 38.15k forks source link

Prefer modified resources over the originals in TestCompiler #33850

Closed wilkinsona closed 2 weeks ago

wilkinsona commented 2 weeks ago

Previously, when the test compiler had been seeded with a resource file, any modifications to this resource performed during compilation would be lost as the original content would always be returned.

This PR updates the DynamicJavaFileManager to always store the dynamic resource in the dynamicResourceFiles map, irrespective of whether it's being created afresh or from some existing resource content. This ensures that any modifications made to the resource can be retrieved later on.

Similarly, DynamicClassLoader has been updated to prefer dynamic resource files over any original resource files. This ensures that the resource that it finds reflects any modifications that have been made to it.