'Thymeleaf cache set to false not working

I have a spring application under development. The configuration of the project is as follows:

  • spring-dev-tools dependency is one of the maven dependencies
  • thymeleaf dependency is added through spring-boot-starter, that is org.springframework.boot:spring-boot-starter-thymeleaf
  • I have explicitly disabled template cache with spring.thymeleaf.cache=false
  • The src/main/resources folder is marked as resource in my IntelliJ IDEA project.

I am using IntelliJ IDEA project to run the application. When I run the application, I can see in the console output that: LiveReload server is running on port 35729
Although, it seems like all my configuration is correct, the running application is not loading any changes I made to the templates while it is running.



Solution 1:[1]

If you are using Spring Tool Suite 4, you need to implement the following in your application.properties to disable the cache from Thymeleaf:

spring.thymeleaf.cache=false
spring.thymeleaf.prefix=file:src/main/resources/templates/

Adding the spring.thymeleaf.prefix value worked for me.

For more information about the solution:

https://github.com/spring-projects/spring-boot/issues/34#issuecomment-316295791

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 pableiros