I have a spring application under development. The configuration of the project is as follows:
org.springframework.boot:spring-boot-starter-thymeleafspring.thymeleaf.cache=falsesrc/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.
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
The LiveReload server loads any changes only when one of the files on the classpath is modified Spring Doc.
Though I have resources, the folder containing templates folder, on the classpath, the changes to the html files in templates folder are not reflected in the running application.
What worked for me is to also add src/main/resources/templates to the classpath i.e. marked as resource in IntelliJ
Thanks
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With