微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

java – Spring Boot和Thymeleaf 3.0.0.RELEASE集成

我有一个问题,当我尝试集成 Spring Boot 1.3.5.RELEASE和Thymeleaf 3.0.0.释放.我知道Spring Boot现在支持Thymeleaf 3版本所以我尝试解决这个问题,如下所示:
@SpringBootApplication(exclude={org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration.class})

添加我自己的SpringWebConfig配置.
不幸的是收到这样的错误

java.lang.classNotFoundException: org.thymeleaf.resourceresolver.IResourceResolver
    at java.net.urlclassloader.findClass(urlclassloader.java:381) ~[na:1.8.0_66]
    at java.lang.classLoader.loadClass(ClassLoader.java:424) ~[na:1.8.0_66]
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331) ~[na:1.8.0_66]
    at java.lang.classLoader.loadClass(ClassLoader.java:357) ~[na:1.8.0_66]
    ... 37 common frames omitted
Wrapped by: java.lang.NoClassDefFoundError: org/thymeleaf/resourceresolver/IResourceResolver



wrapped by: java.lang.IllegalStateException: Could not evaluate condition on org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration due to org/thymeleaf/resourceresolver/IResourceResolver not found. M                                                                                                        ake sure your own configuration does not rely on that class. This can also happen if you are @ComponentScanning a springframework package (e.g. if you put a @ComponentScan in the default package by mistake)

解决方法

它更简单,只需阅读:
http://docs.spring.io/spring-boot/docs/1.5.x/reference/htmlsingle/#howto-use-thymeleaf-3
<properties>
    <thymeleaf.version>3.0.2.RELEASE</thymeleaf.version>
    <thymeleaf-layout-dialect.version>2.1.1</thymeleaf-layout-dialect.version>
</properties>

原文地址:https://www.jb51.cc/java/127949.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐