Image for post
Image for post

Spring Boot: Spring Boot 1.4.x & Thymeleaf 3.x configuration

David Marko
Feb 6, 2017 · 1 min read

Thymeleaf is quite popular template engine widely used among Spring Boot developers. And we use it as well. While working with Spring Boot 1.4.x you will find that spring-boot-starter-thymeleaf is based on older Thymeleaf 2.x version, while there is Thymeleaf 3.x available for some time.

But wait, there is an easy way how to get latest Thymeleaf for my Spring Boot 1.4.x application. There are 3 simple steps to do so.

  1. Reference Thymeleaf in build.gradle file
    (assuming we have Gradle based Spring Boot project)
compile ("org.thymeleaf.extras:thymeleaf-extras-springsecurity4:3.0.0.RELEASE")
compile ("io.github.jpenren:thymeleaf-spring-data-dialect:3.1.1")

2. Specify Thymeleaf version in build.gradle file
Here is the place to say that we want version 3.x of Thymeleaf library

ext["thymeleaf.version"] = "3.0.2.RELEASE"
ext["thymeleaf-layout-dialect.version"] = "2.0.1"

3. (Optional) Create @Configuration class with Thymeleaf configuration options. Spring Boot with detect this and create appropriate beans.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch

Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore

Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store