服务端通知客户端缓存静态页面资源,这样加快页面的加载。
.没加缓解前效果:
在application.properties配置,让服务器告诉客服端静态页面资源要缓存
其中,resources.cache-period是缓存时间,3600秒。
spring.resources.add-mappings=true
spring.resources.cache-period= 3600
spring.resources.chain.cache=true
spring.resources.chain.enabled=true
spring.resources.chain.gzipped=true
spring.resources.chain.html-application-cache=true
spring.resources.static-locations=classpath:/static/
只火狐浏览器可见,“已缓存”效果。