SpringBoot使用国际化报错

it2025-07-21  13

SpringBoot使用国际化错误问题:??xxx.xxx_zh_CN??

具体错误如下图:解决方案:

具体错误如下图:

项目环境: SpringBoot:1.5.9 thymeleaf:3.0.9 thymeleaf布局:2.2.2 jdk:1.8

解决方案:

我报错的原因是因为SpringBoot的配置文件application.yml中的配置为:

spring: messages: basename: i18n.xxx

将配置文件中的配置修改为:

spring: messages: basename: i18n/xxx

然后就重启项目查看结果: 就可以了。 备注: 有的SpringBoot版本使用配置文件中的两种方式都可以。

最新回复(0)