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

比如:application.properties内容:

student.name=小康
student.age=15

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

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

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

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

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

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

我的座右铭:不会,我可以学;落后,我可以追赶;跌倒,我可以站起来;我一定行。

相关文章:

  • 2021-11-04
  • 2021-10-26
  • 2021-07-13
  • 2021-08-13
  • 2021-11-06
  • 2021-11-14
  • 2022-01-21
  • 2021-12-03
猜你喜欢
  • 2021-08-25
  • 2021-07-05
  • 2021-06-18
  • 2021-08-13
  • 2021-08-13
  • 2021-11-19
  • 2021-10-26
  • 2021-03-26
相关资源
相似解决方案