argos/dmp-backend/web/src/main/java/eu/eudat/configurations/WebMVCConfiguration.java

35 lines
1.1 KiB
Java

package eu.eudat.configurations;
import eu.eudat.interceptors.UserInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.List;
@EnableAsync
@Configuration
@EnableScheduling
public class WebMVCConfiguration implements WebMvcConfigurer {
private final UserInterceptor userInterceptor;
@Autowired
public WebMVCConfiguration(UserInterceptor userInterceptor) {
this.userInterceptor = userInterceptor;
}
@Autowired
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addWebRequestInterceptor(userInterceptor).order(1);
}
}