在我的Spring Boot MVC项目中,我在'resources'文件夹下有'messages_en.properties'和'messages_uk.properties'。 消息源配置:未找到消息源.properties文件
@Bean
public ResourceBundleMessageSource messageSource() {
return new ResourceBundleMessageSource();
}
application.properties:
spring.messages.basename=messages
而我得到的,而不是在模板中的消息是这样的:
?contact.email_en_US?
以前它工作得很好,即使没有配置(只需将messagess包放在同一文件夹中)。也许这个问题与locale有关?
的重复http://stackoverflow.com/questions/35301642/after-switching-from-spring-boot- 1-2-8-1-3-3-应用程序 - 魔法停止工作/ 35311589#35311589? –
我认为应该将messages_en.properties或messages_uk.properties(取决于您所在的国家/地区)重命名为message.properties。您必须至少有一个默认文件。 –