Spring Boot + Thymeleaf ERROR java.lang.ClassNotFoundException: org.thymeleaf.dom.Attribute

Adding the following to your properties should fix it.

<properties>
    ... other properties here ...
    <thymeleaf.version>3.0.3.RELEASE</thymeleaf.version>
    <thymeleaf-layout-dialect.version>2.2.1</thymeleaf-layout-dialect.version>
</properties>

I am using the same setup with a project based on:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.2.RELEASE</version>
    <relativePath/>
</parent>

Edit: make sure to use the latest versions of spring and thymeleaf ;)


I got error classnotfoundexception: org.thymeleaf.spring5.ispringtemplateengine when I started upgrading Spring Boot 1.5.14 to Spring Boot 2.0.4. When googling, this thread was the top result.

I was already using Thymeleaf 3.0.7. After the Spring Boot upgrade, it no longer worked. After some trial and error, I noticed I didn't upgrade dependency thymeleaf-spring4 to thymeleaf-spring5 and while I was at it, I upgraded Thymeleaf to 3.0.9. This for me did the trick.