Thymeleaf & Spring MVC: Can live template edits propagate across rolling instances during zero‑downtime migration?
0 reputation · 15 Oct 2020, 08:05 UTC
0 reputation · 15 Oct 2020, 08:05 UTC
Upgrade a small Spring MVC application to a new Thymeleaf version while keeping the service available. The objective is to deploy the new template engine without a full restart, ensuring that all users receive consistent views during the transition.
Thymeleaf caches parsed templates by default in Spring Boot production mode. When a template file is modified, the change is not seen by existing instances until the cache is evicted or the JVM restarts. Rolling restarts can leave a mix of old and new instances, each potentially holding different template versions or dialects. Mixing StandardDialect with SpringStandardDialect across instances can cause rendering errors. Spring Boot devtools can disable caching and enable live reload, but it is intended for development and may introduce performance overhead in production.
Is there a supported, production‑grade approach to force a live cache refresh across all instances during a rolling deployment, or must the migration accept a brief period of inconsistent rendering?
A thoughtful contribution can make all the difference. Be the first to share one.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.