I'm using Spring MVC with Thymeleaf and Tomcat and I want to be able update static data (html pages) without redeploy. In my application html is mapping by Spring controller. Even JRebel doesn't helps. It updates java classes great, but does nothing with view. What should I do to solve this issue? Maybe for html I need some listener mechanism like Jasper for JSP, or maybe I should disable some cache for Spring controller?..
Asked
Active
Viewed 5,585 times
1 Answers
23
This actually was Thymeleaf issue. I just had to disable caching for templateResolver, which is ON by default.
<bean id="templateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
<property name="prefix" value="/" />
<property name="suffix" value=".html" />
<property name="templateMode" value="HTML5" />
<property name="cacheable" value="false"/>
</bean>

Maxim Kolesnikov
- 5,075
- 6
- 38
- 68
-
I've been looking for that clue. Thank you, Maksim! Very helpful. – MiB Mar 10 '14 at 20:09
-
I have this setting set, but my pages still are cached, even when I restart the server. – trusktr Mar 13 '14 at 18:25
-
Any idea why that might be? – trusktr Mar 13 '14 at 18:49
-
If server restart doesn't help when it's not a Thymeleaf issue. It may be a browser's cache. Try to reload page using `Ctrl+F5`. If it helps, then one of this solutions may be helpful for you: http://stackoverflow.com/a/2068407/1430055 or http://stackoverflow.com/a/1341133/1430055 – Maxim Kolesnikov Mar 13 '14 at 18:55
-
Thanks, the page not reloading was driving me crazy. – Mushtaq Jameel Aug 05 '14 at 06:30
-
I tried to use
but it didn't work – Marco C Aug 10 '14 at 10:05 -
1in java config: `yourTemplateResolver.setCacheable(false);` – LeOn - Han Li Mar 17 '17 at 19:54