package org.synyx.urlaubsverwaltung.web.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.synyx.urlaubsverwaltung.web.UserInterceptor;


@Configuration
public class WebMvcConfig implements WebMvcConfigurer {

    private final UserInterceptor userInterceptor;

    @Autowired
    public WebMvcConfig(UserInterceptor userInterceptor) {
        this.userInterceptor = userInterceptor;
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        // add signedInUser to modelAndViews
        registry.addInterceptor(userInterceptor).addPathPatterns("/web/**");
    }
}

@@ -166,16 +166,62 @@
 ration;%0A
+import org.springframework.http.CacheControl;%0A
 import o
@@ -290,16 +290,98 @@
 gistry;%0A
+import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;%0A
 import o
@@ -504,16 +504,55 @@
 eptor;%0A%0A
+import java.util.concurrent.TimeUnit;%0A%0A
 %0A@Config
@@ -920,16 +920,16 @@
 ndViews%0A
-
         
@@ -1002,11 +1002,225 @@
 );%0A    %7D
+%0A%0A    @Override%0A    public void addResourceHandlers(ResourceHandlerRegistry registry) %7B%0A        registry%0A            .addResourceHandler(%22/assets/**%22).setCacheControl(CacheControl.maxAge(365, TimeUnit.DAYS));%0A    %7D
 %0A%7D%0A

set cache header max-age for generated assets