只需要在application.yaml中配置tomcat.uri-encoding=utf-8和servlet.encoding.charset=utf-8
server:
port: 8088
servlet:
context-path: /
encoding:
enabled: true
force: true
charset: UTF-8
compression:
enabled: true
tomcat:
uri-encoding: UTF-8
spring:
main:
banner-mode: off #关闭控制台banner
messages:
basename: i18n/message #国际化配置文件地址
encoding: utf-8
mvc:
pathmatch:
matching-strategy: ant_path_matcher #不加会导致出错springboot集成Swagger2启动报错
thymeleaf:
#开启thymeleaf视图解析
enabled: true
#模板的模式,支持 HTML, XML TEXT JAVASCRIPT
mode: HTML
#编码 可不用配置
encoding: UTF-8
#开发配置为false,避免修改模板还要重启服务器
cache: false
servlet:
content-type: text/html
#配置模板路径,默认是templates,可以不用配置
prefix: classpath:/templates/
#后缀名
suffix: .html