Created
November 13, 2024 04:11
-
-
Save guaracyalima/1fff72864d7851c8d35afdffb7ad7c60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package br.com.zeroth.zth_product_srv.config; | |
import jakarta.servlet.Filter; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.http.CacheControl; | |
import org.springframework.web.filter.ShallowEtagHeaderFilter; | |
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; | |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |
@Configuration | |
public class WebConfig implements WebMvcConfigurer { | |
@Bean | |
public Filter shallowEtagHeaderFilter(){ | |
return new ShallowEtagHeaderFilter(); | |
} | |
@Override | |
public void addResourceHandlers(ResourceHandlerRegistry registry){ | |
registry | |
.addResourceHandler("/static/**") | |
.addResourceLocations("/classpath:/static/") | |
.setCacheControl(CacheControl.noCache()) | |
.setCachePeriod(3600); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment