当springboot 使用thymeleaf 模板引擎时报错org.xml.sax.SAXParseException: 元素类型 “link” 必须由匹配的结束标记 “” 终止,org.xml.sax.SAXParseException: 元素类型 “meta” 必须由匹配的结束标记 “” 终止。等等问题。 解决方法是在pom.xml 文件中指定具体的thymeleaf 版本 具体如下

 <properties>
 <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
 <java.version>1.8</java.version> 
<!--以下两项需要如果不配置,解析themleaft 会有问题-->
 <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
 <thymeleaf-layout-dialect.version>2.0.5</thymeleaf-layout-dialect.version>
 </properties>