Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Spring Boot and Thymeleaf 3.0.0.RELEASE integration

I have a problem, when I try integrate Spring Boot 1.3.5.RELEASE and Thymeleaf 3.0.0.Release. I know that Spring Boot now support Thymeleaf 3 version so I try workaround this problem like this :

@SpringBootApplication(exclude={org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration.class})

and add my own SpringWebConfig configuration. unfortunately received error like this :

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)
like image 605
przodownikPracy Avatar asked May 25 '16 13:05

przodownikPracy


People also ask

Is Thymeleaf fully integrated with Spring?

It provides full integration with Spring Framework. It applies a set of transformations to template files in order to display data or text produced by the application. It is appropriate for serving XHTML/HTML5 in web applications. The goal of Thymeleaf is to provide a stylish and well-formed way of creating templates.

Is Thymeleaf outdated?

While Thymeleaf is more of a template engine for server-side application development. But Thymeleaf's popularity is on a steady rise. The developer community is slowly moving away from 'once a common' MVC framework for Javascript-based development.

Can we use Thymeleaf with REST API?

Thymeleaf is a Java template engine for processing and creating HTML, XML, JavaScript, CSS, and text. When you are using JSON API and parse the JSON and use angular or any other client-side rendering framework for that. Thymeleaf with REST is not the approach.


1 Answers

It's much simpler, just read this: 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>
like image 104
Henrique Rocha Avatar answered Sep 18 '22 14:09

Henrique Rocha