在application.properties资源文件中设置两个自定义的属性以及属性值:

com.sxd.name = "德玛西亚"
com.sxd.want = "王者荣耀"

 

然后获取资源文件中定义的属性值出现乱码。

 

解决方法:

在资源文件中添加如下:

banner.charset=UTF-8
server.tomcat.uri-encoding=UTF-8
spring.http.encoding.charset=UTF-8
spring.http.encoding.enabled=true
spring.http.encoding.force=true
spring.messages.encoding=UTF-8

【IntelliJ IDEA】从资源文件读取出来就中文乱码的解决方法

 【IntelliJ IDEA】从资源文件读取出来就中文乱码的解决方法

【IntelliJ IDEA】从资源文件读取出来就中文乱码的解决方法

 

相关文章:

  • 2022-12-23
  • 2022-02-12
  • 2022-12-23
  • 2021-05-10
  • 2021-08-16
  • 2021-06-29
  • 2021-10-26
猜你喜欢
  • 2021-11-28
  • 2021-05-15
  • 2021-12-17
  • 2021-09-20
  • 2021-09-16
  • 2021-10-31
相关资源
相似解决方案