Reputation: 5967
I followed the demo of spring loaded from here http://www.youtube.com/watch?v=GTrNkhVnJBU
It works great for class changes but is there a way to get it working for the view layer, specifically Spring MVC with Thymeleaf templates.
Upvotes: 1
Views: 4630
Reputation: 13910
You can simply disable the cache for Thymeleaf.
For more details here is a post that treats this topic: http://blog.netgloo.com/2014/05/21/hot-swapping-in-spring-boot-with-eclipse-sts/
Upvotes: 1
Reputation: 1791
You can turn down caching by adding the cacheable property to false. (True by default)
<bean id="templateResolver"
class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
<property name="prefix" value="/WEB-INF/templates/" />
<property name="suffix" value=".html" />
<property name="templateMode" value="HTML5" />
<!-- Disable Caching of templates -->
<property name="cacheable" value="false" />
</bean>
Upvotes: 0
Reputation: 7309
Thymeleaf pages are no JAVA-Sources, so it can't work. However Thymeleaf can deal with the problem without an enhancements. It's just a question of configuration
@Bean()
public ServletContextTemplateResolver templateResolver() {
final ServletContextTemplateResolver resolver =
new ServletContextTemplateResolver();
resolver.setPrefix("/WEB-INF/templates/");
resolver.setSuffix(".html");
resolver.setTemplateMode("HTML5");
resolver.setCacheable(cacheable);
resolver.setCharacterEncoding("UTF-8");
return resolver;
}
Above you can see my configuration in FuWeSta-Sample. Just add resolver.setCacheable(false);
Upvotes: 3