加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > Java > 正文

java – Spring Boot和Thymeleaf 3.0.0.RELEASE集成

发布时间:2020-12-15 02:50:18 所属栏目:Java 来源:网络整理
导读:我有一个问题,当我尝试集成 Spring Boot 1.3.5.RELEASE和Thymeleaf 3.0.0.释放.我知道Spring Boot现在支持Thymeleaf 3版本所以我尝试解决这个问题,如下所示: @SpringBootApplication(exclude={org.springframework.boot.autoconfigure.thymeleaf.ThymeleafA
我有一个问题,当我尝试集成 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>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读