这个问题,一开始以为是nginx的问题,又觉得是页面没加<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />标签,也使用了
#thymeleaf spring.thymeleaf.mode=HTML spring.thymeleaf.encoding=UTF-8 spring.thymeleaf.prefix=classpath:/templates/
这写配置。最后证明,还是controller返回的时候,路径多写了个/。因为springboot默认的页面路径是/templates/,所以如果自己再写就重复了。