I have a simple Spring Boot app with a static content. I would like the browsers to cache not all but just some of the types, like css. So I added following configuration:
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry.addResourceHandler("/css/**").addResourceLocations("/css/")
.setCacheControl(CacheControl.maxAge(365, TimeUnit.DAYS));
}
But now all the CSS files are server as Content-Type: application/json. Without this code they are served as text/css. I cannot figure out what am I doing wrong. Is there anything I should check or add?
Thanks in advance.