第一步:IntelliJ IDEA编码设置
第二步:在 application.properties中添加配置项
1 spring.http.encoding.force=true 2 spring.http.encoding.charset=UTF-8 3 spring.http.encoding.enabled=true 4 server.tomcat.uri-encoding=UTF-8
第三步:在pom.xml加上如下配置:
1 <properties> 2 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 3 <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> 4 <java.version>1.8</java.version> 5 </properties>
搞定!!!!