org.thymeleaf.exceptions.TemplateInputException: Exception parsing document: template="login"
原因:
Spring Boot項目渲染html的時候,因默認使用是Thymeleaf模板引擎,遇到不閉合標簽報錯,日常在編寫HTML代碼時,一般標簽都是閉合的,容易忽略的標簽包括<meta/>, <link/>, <br/>, <hr/>等等
解決辦法:
applications.properties 中添加:
spring.thymeleaf.mode=LEGACYHTML5
org.thymeleaf.exceptions.ConfigurationException: Cannot perform conversion to XML from legacy HTML: The nekoHTML library is not in classpath. nekoHTML 1.9.15 or newer is required for processing templates in "LEGACYHTML5" ,缺包。
解決辦法:
build.gradle 中添加
compile("net.sourceforge.nekohtml:nekohtml:1.9.22")