一说是pom.xml中添加,实测并没有用:

<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</dependency>

一说是application.properties中:
默认是: ​​​spring.thymeleaf.mode=HTML5​​​ 修改为: ​​spring.thymeleaf.mode=LEGACYHTML5​

问题解决。