springboot設定UTF-8

lkm_0617發表於2020-10-16

application.properties

#解決返回亂碼問題
#spring.http.encoding.charset=UTF-8
#spring.http.encoding.force=true
#spring.http.encoding.enabled=true
server.servlet.encoding.charset=UTF-8
server.servlet.encoding.force=true
server.servlet.encoding.enabled=true

pom.xml

properties里加兩行程式碼含在<java.version>1.8</java.version>一起

<properties>
		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
		<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
		<java.version>1.8</java.version>
</properties>

相關文章