在resources下新建i18n文件,右击i18n,new Resource Bundle “名称”,接着:
目录结构如下:
配置i18n:
@Configuration
public class I18nConfig {
@Value(value = "${spring.messages.basename}")
private String basename;
@Value(value = "${spring.messages.encoding}")
private String encoding;
//
@Bean(name = "messageSource")
public ResourceBundleMessageSource resourceBundleMessageSource(