springboot+thymeleaf解决css/js浏览器缓存问题

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_16055765/article/details/84134535

1、springboot配置application.yaml中加入

#启用内容版本策略 md5

spring.resources.chain.strategy.content.enabled: true

#应用于版本策略的模式的逗号分隔列表 默认/**

spring.resources.chain.strategy.content.paths: /js/web/**

2、在页面中引入

<script th:src="@{/js/web/common.js}"></script>
<script th:src="@{/js/web/logstate.js}"></script>

3、将js文件放入配置的paths中去

猜你喜欢

转载自blog.csdn.net/qq_16055765/article/details/84134535