java - Thymeleaf Not Hot Swapping Intellij -
i having issues getting thymeleaf templates hot swap / update using intellij. @ moment have full server restart in order see changes, rather tedious , slows down work flow.
i using gradle, intellij 14.1, , tomcat 8. running application in debug mode.
i have tried setting thymeleaf not cacheable.
@configuration public class thymeleafconfig { @autowired environment environment; @bean public servletcontexttemplateresolver templateresolver() { servletcontexttemplateresolver resolver = new servletcontexttemplateresolver(); resolver.setprefix(environment.getrequiredproperty("thymeleaf.resolver.prefix")); resolver.setsuffix(environment.getrequiredproperty("thymeleaf.resolver.suffix")); resolver.settemplatemode(environment.getrequiredproperty("thymeleaf.resolver.templatemode")); resolver.setorder(environment.getrequiredproperty("thymeleaf.resolver.order", integer.class)); resolver.setcacheable(environment.getrequiredproperty("thymeleaf.resolver.cacheable", boolean.class)); resolver.setcharacterencoding(environment.getrequiredproperty("thymeleaf.resolver.character.encoding")); return resolver; } @bean public springtemplateengine templateengine() { springtemplateengine engine = new springtemplateengine(); engine.settemplateresolver(templateresolver()); engine.adddialect(new layoutdialect()); engine.adddialect(new springsecuritydialect()); return engine; } @bean public thymeleafviewresolver thymeleafviewresolver() { thymeleafviewresolver resolver = new thymeleafviewresolver(); resolver.settemplateengine(templateengine()); return resolver; } }
property file above code reading from.
# thymeleaf thymeleaf.resolver.prefix=/web-inf/views/ thymeleaf.resolver.suffix=.html thymeleaf.resolver.templatemode=html5 thymeleaf.resolver.order=1 thymeleaf.resolver.cacheable=false thymeleaf.resolver.character.encoding=utf-8
i tried setting in applicationinitializer.
@override public void onstartup(servletcontext container) throws servletexception { /** * if no active profile set via -dspring.profiles.active application * default development mode */ container.setinitparameter("spring.profiles.default", "dev"); /** * set thymeleaf cache false if -dspring.thymeleaf.cache not passed */ container.setinitparameter("spring.thymeleaf.cache", "false"); /** * create root spring application context */ annotationconfigwebapplicationcontext rootcontext = new annotationconfigwebapplicationcontext(); rootcontext.setdisplayname("app"); rootcontext.register(appconfig.class); /** * manage lifecycle of root application context */ container.addlistener(new contextloaderlistener(rootcontext)); /** * register , map dispatcher servlet */ servletregistration.dynamic dispatcher = container.addservlet("dispatcher", new dispatcherservlet(rootcontext)); dispatcher.setloadonstartup(1); dispatcher.addmapping("/"); } }
so far none of has worked.
select exploded war deployment. can update resources or classes , resources when hit cmd + f10( assume might ctrl on windows/linux).
Comments
Post a Comment