如何解决springboot读取配置文件的中文乱码问题

在application.properties中填写中文信息,在读取该文件时会出现中文乱码问题。

比如:application.properties内容:

student.name=小康

student.age=15

解决方法:我用的是IDEA,首先File->settings->Code style->File Encoding

把所有的编码都设为UTF-8就好了。

再次运行,得出正常结果:

以上是 如何解决springboot读取配置文件的中文乱码问题 的全部内容, 来源链接: utcz.com/p/216481.html

回到顶部