#4 -- Enable caching
All checks were successful
CI fuzzy controller / container-test-job (push) Successful in 59s

This commit is contained in:
Anton Romanov 2025-02-28 21:18:25 +04:00
parent 524a2e9c7b
commit ec07ed36eb

View File

@ -2,6 +2,7 @@ package ru.ulstu.fc.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.CacheControl;
import org.springframework.web.servlet.LocaleResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
@ -10,6 +11,8 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.i18n.CookieLocaleResolver;
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor;
import java.util.concurrent.TimeUnit;
@Configuration
public class MvcConfiguration implements WebMvcConfigurer {
@Override
@ -23,7 +26,11 @@ public class MvcConfiguration implements WebMvcConfigurer {
public void addResourceHandlers(ResourceHandlerRegistry registry) {
registry
.addResourceHandler("/webjars/**")
.addResourceLocations("/webjars/");
.addResourceLocations("/webjars/")
.setCacheControl(CacheControl.maxAge(60, TimeUnit.SECONDS)
.noTransform()
.mustRevalidate());
;
}
@Bean