thymeleaf模版对于前端代码的完整性检查特别严格,比如前端标签必须完整,闭合,否则访问页面的时候会一直报错,头疼
解决方案:
1:在pom.xml中添加一个类库
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
</dependency>
2:在配置thymeleaf模版的时候加上一个配置(application.properties)
spring.thymeleaf.mode=LEGACYHTML5
重新启动工程可以看到,页面可以正常访问了