From 089cda7af418fe7584ec378b987b69d26fd8ea4f Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 21 Aug 2015 15:31:20 +0100 Subject: [PATCH 1/2] Add generated file to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index dc9fe73105..c8d4623526 100644 --- a/.gitignore +++ b/.gitignore @@ -12,6 +12,7 @@ bin build lib/ target +.factorypath .springBeans dependency-reduced-pom.xml build.log From 68b55adac044e2f21a13a46315bdcf13013ede61 Mon Sep 17 00:00:00 2001 From: Dave Syer Date: Fri, 21 Aug 2015 15:44:01 +0100 Subject: [PATCH 2/2] Add search=CURRENT to MessageSourceAutoConfiguration Fixes gh-3803 --- .../MessageSourceAutoConfiguration.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java index c597ea0240..8d6d97ae6d 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java @@ -16,7 +16,11 @@ package org.springframework.boot.autoconfigure; +import static org.springframework.util.StringUtils.commaDelimitedListToStringArray; +import static org.springframework.util.StringUtils.trimAllWhitespace; + import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.SearchStrategy; import org.springframework.boot.bind.RelaxedPropertyResolver; import org.springframework.context.EnvironmentAware; import org.springframework.context.MessageSource; @@ -28,16 +32,13 @@ import org.springframework.core.annotation.Order; import org.springframework.core.env.Environment; import org.springframework.util.StringUtils; -import static org.springframework.util.StringUtils.commaDelimitedListToStringArray; -import static org.springframework.util.StringUtils.trimAllWhitespace; - /** * {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}. - * + * * @author Dave Syer */ @Configuration -@ConditionalOnMissingBean(MessageSource.class) +@ConditionalOnMissingBean(value=MessageSource.class, search=SearchStrategy.CURRENT) @Order(Ordered.HIGHEST_PRECEDENCE) public class MessageSourceAutoConfiguration implements EnvironmentAware { @@ -54,7 +55,7 @@ public class MessageSourceAutoConfiguration implements EnvironmentAware { String basename = this.environment.getProperty("basename", "messages"); if (StringUtils.hasText(basename)) { messageSource - .setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(basename))); + .setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(basename))); } String encoding = this.environment.getProperty("encoding", "utf-8"); messageSource.setDefaultEncoding(encoding);