-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Closed
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is validAn issue that we don't feel is valid
Description
When setting multiple spring message bundles, as advised in https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-internationalization.html:
spring.messages.basename=messages,message-commons
Now if a spring-security error occurs, the spring-security error messages are not loaded correctly. The following warning is printed:
ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale en
Interestingly, if you change the properties to a non-existing resource bundle, eg:
spring.messages.basename=messages,message-commons2
Then the warning disappears!
Reproduce as follows:
@SpringBootApplication
public class ResourcebundleFailureApp {
public static void main(String[] args) {
SpringApplication.run(ResourcebundleFailureApp.class, args);
}
}
@RestController
public class TestController {
@GetMapping("/test")
public void test() {
}
}
application.properties:
spring.messages.basename=messages,message-commons2
message-commons.properties (empty)
Unit test:
@RunWith(SpringRunner.class)
@WebMvcTest(TestController.class)
public class ResourceBundleTest {
@Autowired
private MockMvc mvc;
//fails with 401 unauthorized + prints:
//'ResourceBundle [messages] not found for MessageSource: Can't find bundle for base name messages, locale en'
@Test
public void testBundle() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/test")).andExpect(status().isUnauthorized());
}
}
Of course the test succeeds, but in the logs you see ResourceBundleMessageSource
error.
resourcebundle-failure.zip
Metadata
Metadata
Assignees
Labels
for: external-projectFor an external project and not something we can fixFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is validAn issue that we don't feel is valid