-
在resources创建文件
messages_zh_CN.properties(中文),写入
#Unicode转码 hello=\u4f60\u597D
messages_en_US.properties(英文),写入
hello=hello world
结构如图
-
创建配置类
@Configuration @EnableAutoConfiguration @ComponentScan public class LocaleConfig implements WebMvcConfigurer { //Cookie @Bean public LocaleResolver localeResolver() {
SpringBoot 国际化LocaleContextHolder的基本配置
最新推荐文章于 2024-06-06 17:41:50 发布