SpringBoot – Thymeleaf: Tips

  1. Hot reload, add follow config in application.properties
spring.thymeleaf.cache=false
spring.thymeleaf.prefix=file:src/main/resources/templates/
spring.web.resources.static-locations=file:src/main/resources/static/
spring.thymeleaf.cache.period=0

** ตอน deploy ขึ้น Server ต้อง comment 3 บรรทัดนี้ หรือไป config ใน Jenkins

#spring.thymeleaf.prefix=file:src/main/resources/templates/
#spring.web.resources.static-locations=file:src/main/resources/static/
#spring.thymeleaf.cache.period=0

2. Enable browser cache

spring.web.resources.cache.cachecontrol.max-age=1d