• Andy Wilkinson's avatar
    Avoid capturing TCCL when creating DefaultResourceLoaders · dc75ca39
    Andy Wilkinson authored
    Previously, DefaultResourceLoader instances were created using the
    default constructor. This causes the resource loader to capture the
    TCCL that was in place at that time. This can lead to a class loader
    leak if the resource loader is referenced directly or indirectly from
    a static field of a class loaded by a different class loader.
    
    This commit updates the creation of DefaultResourceLoader instances
    in main code so that the resource load will use the class loader of
    the creating class. In almost all cases this will be the same class
    loader as was the thread context class loader that was being captured
    so the change in behavior is minimal. Crucially, it will still address
    the situation where the TCCL was different.
    
    Note the DevTools' ApplicationContextResourceLoader has been updated
    to explicitly use the TCCL. This ensures that it uses the restart
    class loader which is required for DevTools to function correctly.
    
    Fixes gh-20900
    dc75ca39
Name
Last commit
Last update
..
java/org/springframework/boot/devtools Loading commit data...
resources Loading commit data...