Skip to content

Commit a11f64b

Browse files
committed
Merge branch '4.1.x'
Closes gh-52886
2 parents 087de79 + 8885764 commit a11f64b

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public ConditionOutcome getMatchOutcome(ConditionContext context, AnnotatedTypeM
8484

8585
private ConditionOutcome getMatchOutcomeForBasename(@Nullable ClassLoader classLoader, String basename) {
8686
ConditionMessage.Builder message = ConditionMessage.forCondition("ResourceBundle");
87-
for (String name : StringUtils.commaDelimitedListToStringArray(StringUtils.trimAllWhitespace(basename))) {
87+
for (String name : StringUtils.tokenizeToStringArray(basename, ",")) {
8888
for (Resource resource : getResources(classLoader, name)) {
8989
if (resource.exists()) {
9090
return ConditionOutcome.match(message.found("bundle").items(resource));

‎core/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/context/MessageSourceAutoConfigurationTests.java‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,16 @@ void testMultipleMessageSourceCreated() {
176176
});
177177
}
178178

179+
@Test
180+
@WithResource(name = "test/my messages.properties", content = "foo=bar")
181+
void testMultipleMessageSourceCreatedWithSpacesInBasename() {
182+
this.contextRunner.withPropertyValues("spring.messages.basename=test/my messages, test/messages2")
183+
.run((context) -> {
184+
assertThat(context).hasSingleBean(MessageSource.class);
185+
assertThat(context.getMessage("foo", null, "Foo message", Locale.UK)).isEqualTo("bar");
186+
});
187+
}
188+
179189
@Test
180190
@WithTestMessagesPropertiesResource
181191
@Disabled("Expected to fail per gh-1075")

0 commit comments

Comments
 (0)