Skip to content

Commit

Permalink
fix: Disable the cache of front-end resources
Browse files Browse the repository at this point in the history
  • Loading branch information
CH3CHO committed Dec 26, 2024
1 parent 99a3c46 commit ad83d2d
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@

import org.springframework.context.annotation.Configuration;
import org.springframework.core.io.Resource;
import org.springframework.http.CacheControl;
import org.springframework.lang.NonNull;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
Expand All @@ -36,8 +37,9 @@ public class WebMvcInitializer implements WebMvcConfigurer {

@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/*").addResourceLocations("classpath:/static/").setUseLastModified(true)
.resourceChain(true).addResolver(new PathResourceResolver() {
registry.addResourceHandler("/*").addResourceLocations("classpath:/static/")
.setCacheControl(CacheControl.noStore()).setUseLastModified(false).resourceChain(true)
.addResolver(new PathResourceResolver() {
@Override
protected Resource resolveResourceInternal(HttpServletRequest request, @NonNull String requestPath,
@NonNull List<? extends Resource> locations, @NonNull ResourceResolverChain chain) {
Expand Down

0 comments on commit ad83d2d

Please sign in to comment.