1. 程式人生 > >關於Spring boot中讀取屬性配置文件出現中文亂碼的問題的解決(針對application.properties)

關於Spring boot中讀取屬性配置文件出現中文亂碼的問題的解決(針對application.properties)

HA inf encoding 屬性 文件中 ide for 出現 spring

兩種方法:

方法一:在配置文件中設置中文編碼:

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

方法二:

設置idea的編碼格式

技術分享圖片

關於Spring boot中讀取屬性配置文件出現中文亂碼的問題的解決(針對application.properties)