Modify @Condition for detecting existing message bundle resource
The problem with the old code is that it worces a ResourceBundle to initialize with the default encoding (and that is then cached in the JDK) during @Condition evaluation (so before the encoding is known). Includes test for swedish messages Fixes gh-1228
This commit is contained in:
@@ -58,6 +58,18 @@ public class MessageSourceAutoConfigurationTests {
|
||||
this.context.getMessage("foo", null, "Foo message", Locale.UK));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testEncodingWorks() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.messages.basename:test/swedish");
|
||||
this.context.register(MessageSourceAutoConfiguration.class,
|
||||
PropertyPlaceholderAutoConfiguration.class);
|
||||
this.context.refresh();
|
||||
assertEquals("Some text with some swedish öäå!",
|
||||
this.context.getMessage("foo", null, "Foo message", Locale.UK));
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testMultipleMessageSourceCreated() throws Exception {
|
||||
this.context = new AnnotationConfigApplicationContext();
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
foo=Some text with some swedish öäå!
|
||||
Reference in New Issue
Block a user