我试图用Spring Boot和Thymeleaf运行一个例子.我收到了这个错误:
There was an unexpected error (type=Internal Server Error,
status=500). 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” mode
这些是我的依赖:
org.springframework.boot
spring-boot-starter-jersey
org.springframework.boot
spring-boot-starter-security
org.springframework.boot
spring-boot-starter-thymeleaf
org.thymeleaf.extras
thymeleaf-extras-springsecurity4
2.1.2.RELEASE
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-test
test
这是我的应用程序属性:
spring.thymeleaf.cache=false
spring.thymeleaf.suffix=.html
spring.thymeleaf.mode=LEGACYHTML5
spring.thymeleaf.encoding=UTF-8
spring.thymeleaf.content-type=text/html
当我添加Neko HTML依赖性错误消失.但是它应该通过我当前的依赖项包含在内.可能是什么问题?
解决方法:
对于Maven,简单地添加这个依赖:
mvn依赖:tree -Dincludes = net.sourceforge.nekohtml:nekohtml
结果没什么
似乎spring-boot-thymeleaf不包括nekohtml库.
compile group: 'net.sourceforge.nekohtml', name: 'nekohtml', version: '1.9.22'
标签:java,spring,spring-boot,spring-mvc,thymeleaf
来源: https://codeday.me/bug/20190828/1756320.html