Template caching stores parsed or processed templates so they do not need to be reparsed for every request. In Spring Boot, each supported template engine exposes a cache property that can be enabled or disabled. section 2.5.1
Use these approaches when configuring template caching:
- Disable caching during development by setting the selected engine’s cache property to false. section 2.5.1
- For Thymeleaf, add spring.thymeleaf.cache=false to application.properties. section 2.5.1
- Remove the false setting or change it to true before production deployment; alternatively, let Spring Boot DevTools disable template caches during development and reenable them when DevTools disables itself in production. section 1.3.5 section 2.5.1
Table 2.3 Properties to enable/disable template caching (view table figure)
Compare the cache-enable properties for FreeMarker, Groovy templates, Mustache, and Thymeleaf. section 2.5.1
