问题
在spring boot 中,推荐使用thymeleaf来做前端模版引擎,但是会报标签未关闭:
org.thymeleaf.exceptions.TemplateInputException: Exception parsing document: template="login"
比如:<link rel="stylesheet" type="text/css" href="../css/bootstrap.css" >
必须改成<link rel="stylesheet" type="text/css" href="../css/bootstrap.css" />
;
如果一个一个改的话又很麻烦。。。ヽ(#`Д´)ノ
解决
1.在pom.xml
中引入依赖:
<dependencies>
<!--thymeleaf-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>net.sourceforge.nekohtml</groupId>
<artifactId>nekohtml</artifactId>
<version>1.9.22</version>
</dependency>
</dependencies>
2.在application-dev.yml
中设置:
spring:
thymeleaf:
cache: false
mode: LEGACYHTML5
server:
port: 8081