How to avoid cleaning my project and restarting tomcat bewteen changes to Thymeleaf templates?

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

How to avoid cleaning my project and restarting tomcat bewteen changes to Thymeleaf templates?

balteo
Hello!

I noticed that each time I change a Thymeleaf template, I have to clean my project (using Eclipse) and restart Tomcat in order to see the changes brought to my Thymeleaf template.

I also work on similar project that uses JSP and I don't have to go through the above steps in order to see the changes.

Is there a way to avoid the clean and restart steps above when working with Thymeleaf templates? Perhaps a config in Eclipse?

Regards,

Julien.
Reply | Threaded
Open this post in threaded view
|

Re: How to avoid cleaning my project and restarting tomcat bewteen changes to Thymeleaf templates?

Zemi
Administrator
Maybe you have the cache enabled, try disabling it.

It is the property "cacheable" of TemplateResolver.

Reply | Threaded
Open this post in threaded view
|

Re: How to avoid cleaning my project and restarting tomcat bewteen changes to Thymeleaf templates?

balteo
Thanks for this reply Zemi,
It is odd because I currently haven't any cache configuration. Have a look at my template:
<bean id="webTemplateResolver" class="org.thymeleaf.templateresolver.ServletContextTemplateResolver">
		<property name="prefix" value="WEB-INF/templates/" />
		<property name="suffix" value=".html" />
		<property name="templateMode" value="HTML5" />
		<property name="characterEncoding" value="UTF-8" />
		<property name="order" value="2" />
	</bean>
Then does it mean caching is enabled by default?
Regards,
Julien.
Reply | Threaded
Open this post in threaded view
|

Re: How to avoid cleaning my project and restarting tomcat bewteen changes to Thymeleaf templates?

Zemi
Administrator
Yes, it is.

Use
        <property name="cacheable" value="false" />
for development.

Reply | Threaded
Open this post in threaded view
|

Re: How to avoid cleaning my project and restarting tomcat bewteen changes to Thymeleaf templates?

balteo
Thank you very much Zemi!
Reply | Threaded
Open this post in threaded view
|

Re: How to avoid cleaning my project and restarting tomcat bewteen changes to Thymeleaf templates?

jszczepankiewicz
not directly relevant but if you want to achieve ultra high perfomance (production server) + have the abilitiy to refresh templates on line you can use JDK directory change watchers and invalidate template cache. With this you will gain no I/O lags and may use very long expire times.