springboot 静态资源 js css 缓存设置
@Configuration
public class WebMvcConfiguration implements WebMvcConfigurer {
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/resources/**")
.addResourceLocations("/resources/")
.setCachePeriod(31556926);
registry.addResourceHandler("/webjars/**")
.addResourceLocations("/webjars/")
.setCachePeriod(31556926);
}
}
<script src="/webjars/ueditor/ueditor.all.min.js"></script>