Skip to content

Commit ff8a4d0

Browse files
committed
Merge branch '1.0.x'
Conflicts: MessageSourceAutoConfiguration.java
2 parents 2583f80 + 68b55ad commit ff8a4d0

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ bin
1515
build
1616
lib/
1717
target
18+
.factorypath
1819
.springBeans
1920
interpolated*.xml
2021
dependency-reduced-pom.xml

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/MessageSourceAutoConfiguration.java

+16-15
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616

1717
package org.springframework.boot.autoconfigure;
1818

19+
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
20+
import static org.springframework.util.StringUtils.trimAllWhitespace;
21+
1922
import java.io.IOException;
2023
import java.nio.charset.Charset;
2124
import java.util.Iterator;
@@ -24,6 +27,7 @@
2427
import org.springframework.boot.autoconfigure.MessageSourceAutoConfiguration.ResourceBundleCondition;
2528
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
2629
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
30+
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
2731
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
2832
import org.springframework.boot.context.properties.ConfigurationProperties;
2933
import org.springframework.boot.context.properties.EnableConfigurationProperties;
@@ -40,9 +44,6 @@
4044
import org.springframework.util.ConcurrentReferenceHashMap;
4145
import org.springframework.util.StringUtils;
4246

43-
import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
44-
import static org.springframework.util.StringUtils.trimAllWhitespace;
45-
4647
/**
4748
* {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}.
4849
*
@@ -51,7 +52,7 @@
5152
* @author Eddú Meléndez
5253
*/
5354
@Configuration
54-
@ConditionalOnMissingBean(MessageSource.class)
55+
@ConditionalOnMissingBean(value=MessageSource.class, search=SearchStrategy.CURRENT)
5556
@AutoConfigureOrder(Ordered.HIGHEST_PRECEDENCE)
5657
@Conditional(ResourceBundleCondition.class)
5758
@EnableConfigurationProperties
@@ -90,7 +91,7 @@ public MessageSource messageSource() {
9091
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
9192
if (StringUtils.hasText(this.basename)) {
9293
messageSource
93-
.setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(this.basename)));
94+
.setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(this.basename)));
9495
}
9596
if (this.encoding != null) {
9697
messageSource.setDefaultEncoding(this.encoding.name());
@@ -166,7 +167,7 @@ private ConditionOutcome getMatchOutcomeForBasename(ConditionContext context,
166167
private Resource[] getResources(ClassLoader classLoader, String name) {
167168
try {
168169
return new SkipPatternPathMatchingResourcePatternResolver(classLoader)
169-
.getResources("classpath*:" + name + "*.properties");
170+
.getResources("classpath*:" + name + "*.properties");
170171
}
171172
catch (Exception ex) {
172173
return NO_RESOURCES;
@@ -180,7 +181,7 @@ private Resource[] getResources(ClassLoader classLoader, String name) {
180181
* contain messages.properties.
181182
*/
182183
private static class SkipPatternPathMatchingResourcePatternResolver extends
183-
PathMatchingResourcePatternResolver {
184+
PathMatchingResourcePatternResolver {
184185

185186
private static final ClassLoader ROOT_CLASSLOADER;
186187
static {
@@ -197,14 +198,14 @@ private static class SkipPatternPathMatchingResourcePatternResolver extends
197198
}
198199

199200
private static final String[] SKIPPED = { "aspectjweaver-", "hibernate-core-",
200-
"hsqldb-", "jackson-annotations-", "jackson-core-", "jackson-databind-",
201-
"javassist-", "snakeyaml-", "spring-aop-", "spring-beans-",
202-
"spring-boot-", "spring-boot-actuator-", "spring-boot-autoconfigure-",
203-
"spring-core-", "spring-context-", "spring-data-commons-",
204-
"spring-expression-", "spring-jdbc-", "spring-orm-", "spring-tx-",
205-
"spring-web-", "spring-webmvc-", "tomcat-embed-", "joda-time-",
206-
"hibernate-entitymanager-", "hibernate-validator-", "logback-classic-",
207-
"logback-core-", "thymeleaf-" };
201+
"hsqldb-", "jackson-annotations-", "jackson-core-", "jackson-databind-",
202+
"javassist-", "snakeyaml-", "spring-aop-", "spring-beans-",
203+
"spring-boot-", "spring-boot-actuator-", "spring-boot-autoconfigure-",
204+
"spring-core-", "spring-context-", "spring-data-commons-",
205+
"spring-expression-", "spring-jdbc-", "spring-orm-", "spring-tx-",
206+
"spring-web-", "spring-webmvc-", "tomcat-embed-", "joda-time-",
207+
"hibernate-entitymanager-", "hibernate-validator-", "logback-classic-",
208+
"logback-core-", "thymeleaf-" };
208209

209210
public SkipPatternPathMatchingResourcePatternResolver(ClassLoader classLoader) {
210211
super(classLoader);

spring-boot-dependencies/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -2129,4 +2129,4 @@
21292129
<id>integration-test</id>
21302130
</profile>
21312131
</profiles>
2132-
</project>
2132+
</project>

0 commit comments

Comments
 (0)