diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java index f4472fd0e4b..86c3baa1b9a 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/jdbc/DataSourceInitializer.java @@ -67,8 +67,7 @@ class DataSourceInitializer { DataSourceInitializer(DataSource dataSource, DataSourceProperties properties, ResourceLoader resourceLoader) { this.dataSource = dataSource; this.properties = properties; - this.resourceLoader = (resourceLoader != null) ? resourceLoader - : new DefaultResourceLoader(getClass().getClassLoader()); + this.resourceLoader = (resourceLoader != null) ? resourceLoader : new DefaultResourceLoader(null); } /** diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java index 54c2bd6f143..3f119ce4bd0 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mustache/MustacheResourceTemplateLoader.java @@ -47,7 +47,7 @@ public class MustacheResourceTemplateLoader implements TemplateLoader, ResourceL private String charSet = "UTF-8"; - private ResourceLoader resourceLoader = new DefaultResourceLoader(getClass().getClassLoader()); + private ResourceLoader resourceLoader = new DefaultResourceLoader(null); public MustacheResourceTemplateLoader() { } diff --git a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java index 8d6cdad7c69..239d190e195 100644 --- a/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java +++ b/spring-boot-project/spring-boot-devtools/src/main/java/org/springframework/boot/devtools/restart/ClassLoaderFilesResourcePatternResolver.java @@ -238,8 +238,7 @@ final class ClassLoaderFilesResourcePatternResolver implements ResourcePatternRe private final Supplier> protocolResolvers; ApplicationContextResourceLoader(Supplier> protocolResolvers) { - // Use the restart class loader - super(Thread.currentThread().getContextClassLoader()); + super(null); this.protocolResolvers = protocolResolvers; } diff --git a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java index b737e6e0fe4..360af8dd83e 100644 --- a/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java +++ b/spring-boot-project/spring-boot-test/src/main/java/org/springframework/boot/test/context/SpringBootContextLoader.java @@ -95,7 +95,7 @@ public class SpringBootContextLoader extends AbstractContextLoader { setActiveProfiles(environment, config.getActiveProfiles()); } ResourceLoader resourceLoader = (application.getResourceLoader() != null) ? application.getResourceLoader() - : new DefaultResourceLoader(getClass().getClassLoader()); + : new DefaultResourceLoader(null); TestPropertySourceUtils.addPropertiesFilesToEnvironment(environment, resourceLoader, config.getPropertySourceLocations()); TestPropertySourceUtils.addInlinedPropertiesToEnvironment(environment, getInlinedProperties(config)); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java index b35cccb6c41..1b18f956434 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/SpringApplication.java @@ -550,7 +550,7 @@ public class SpringApplication { return null; } ResourceLoader resourceLoader = (this.resourceLoader != null) ? this.resourceLoader - : new DefaultResourceLoader(getClassLoader()); + : new DefaultResourceLoader(null); SpringApplicationBannerPrinter bannerPrinter = new SpringApplicationBannerPrinter(resourceLoader, this.banner); if (this.bannerMode == Mode.LOG) { return bannerPrinter.print(environment, this.mainApplicationClass, logger); diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java index 8036438c0a6..2e8972db685 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigFileApplicationListener.java @@ -326,8 +326,7 @@ public class ConfigFileApplicationListener implements EnvironmentPostProcessor, Loader(ConfigurableEnvironment environment, ResourceLoader resourceLoader) { this.environment = environment; this.placeholdersResolver = new PropertySourcesPlaceholdersResolver(this.environment); - this.resourceLoader = (resourceLoader != null) ? resourceLoader - : new DefaultResourceLoader(getClass().getClassLoader()); + this.resourceLoader = (resourceLoader != null) ? resourceLoader : new DefaultResourceLoader(null); this.propertySourceLoaders = SpringFactoriesLoader.loadFactories(PropertySourceLoader.class, getClass().getClassLoader()); } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToFileConverter.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToFileConverter.java index f149d9d872b..14a04ff335c 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToFileConverter.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/convert/StringToFileConverter.java @@ -33,8 +33,7 @@ import org.springframework.util.ResourceUtils; */ class StringToFileConverter implements Converter { - private static final ResourceLoader resourceLoader = new DefaultResourceLoader( - StringToFileConverter.class.getClassLoader()); + private static final ResourceLoader resourceLoader = new DefaultResourceLoader(null); @Override public File convert(String source) {