EN
Spring Boot - setCachePeriod for /static data from application.properties
9
points
In this short article, we would like to show how to enable static resources caching by Spring Boot Application using application.properties file.
resources/application.properties file:
...
spring.web.resources.cache.period=P30D
...
Where:
P30Dmeans 30 days period.
We can set 30 days using seconds:
spring.web.resources.cache.period=2592000
From documentation:
spring.web.resources.cache.period- Cache period for the resources served by the resource handler. If a duration suffix is not specified, seconds will be used.Can be overridden by the
spring.web.resources.cache.cachecontrolproperties.