From a0087170e01ef2a23960f407349909626d816852 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Fri, 29 May 2015 23:42:14 -0700 Subject: [PATCH] Polish --- .../autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java | 2 +- .../java/org/springframework/boot/BeanDefinitionLoader.java | 6 ++---- .../org/springframework/boot/env/PropertySourcesLoader.java | 2 +- .../org/springframework/boot/SpringApplicationTests.java | 1 + 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java index 9bae80fcbc..c72780e747 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/thymeleaf/ThymeleafAutoConfiguration.java @@ -87,7 +87,7 @@ public class ThymeleafAutoConfiguration { } @Bean - public ITemplateResolver defaultTemplateResolver() { + public TemplateResolver defaultTemplateResolver() { TemplateResolver resolver = new TemplateResolver(); resolver.setResourceResolver(thymeleafResourceResolver()); resolver.setPrefix(this.properties.getPrefix()); diff --git a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java index 9721b0bd5c..20e5de9ede 100644 --- a/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/BeanDefinitionLoader.java @@ -54,8 +54,6 @@ import org.springframework.util.StringUtils; */ class BeanDefinitionLoader { - private static final ResourceLoader DEFAULT_RESOURCE_LOADER = new PathMatchingResourcePatternResolver(); - private final Object[] sources; private final AnnotatedBeanDefinitionReader annotatedReader; @@ -228,8 +226,8 @@ class BeanDefinitionLoader { } private Resource[] findResources(String source) { - ResourceLoader loader = this.resourceLoader != null ? this.resourceLoader - : DEFAULT_RESOURCE_LOADER; + ResourceLoader loader = (this.resourceLoader != null ? this.resourceLoader + : new PathMatchingResourcePatternResolver()); try { if (loader instanceof ResourcePatternResolver) { return ((ResourcePatternResolver) loader).getResources(source); diff --git a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java index 0de36c6685..c3942851cf 100644 --- a/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java +++ b/spring-boot/src/main/java/org/springframework/boot/env/PropertySourcesLoader.java @@ -62,7 +62,7 @@ public class PropertySourcesLoader { Assert.notNull(propertySources, "PropertySources must not be null"); this.propertySources = propertySources; this.loaders = SpringFactoriesLoader.loadFactories(PropertySourceLoader.class, - null); + getClass().getClassLoader()); } /** diff --git a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java index d80a3e45a7..fe2e606cb1 100644 --- a/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/SpringApplicationTests.java @@ -767,4 +767,5 @@ public class SpringApplicationTests { } } + }