Skip to main content

Posts

Showing posts from September, 2017

Spring Boot, Thymeleaf static resource refresh

Introduction
Thymeleaf is a natural template engine that is often used in modern java-server-side applications that are running in web and standalone environments. Ease of natural templating gives the upperhand to pick Thymeleaf over other frameworks in Java Serverside application development. Spring provides support to thmyeleaf development. Spring boot has its own starter dependency for thymeleaf. While we develop thmyeleaf templates using spring boot applications, Front End Developers cannot see the changes that are made in the resources while the application is running. But the changes don't take effect in the browser until the application is reloaded or restarted.

Solution
We can solve this templating-resources-reloading without application restart. Spring boot uses properties in which we have to just disable the cache for Thymeleaf. Below are the steps to achieve these.

Step 1: Disable the cache by setting the spring.thymeleaf.cache = false in the application.properties file.