thymeleafspring-loaded

Refreshing Thymeleaf pages with Spring loaded


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.


Solution

  • 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);