package eu.eudat.configurations; import eu.eudat.controllers.interceptors.RequestInterceptor; import eu.eudat.handlers.PrincipalArgumentResolver; import eu.eudat.services.ApiContext; import eu.eudat.services.operations.AuthenticationService; import eu.eudat.services.operations.AuthenticationServiceImpl; import eu.eudat.types.WarningLevel; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.Configuration; import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.web.method.support.HandlerMethodArgumentResolver; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; import java.util.List; @EnableAsync @Configuration public class WebMVCConfiguration extends WebMvcConfigurerAdapter { private ApiContext apiContext; private AuthenticationService authenticationService; @Autowired public WebMVCConfiguration(ApiContext apiContext, AuthenticationService authenticationService) { this.apiContext = apiContext; this.authenticationService = authenticationService; } @Autowired @Override public void addArgumentResolvers(List argumentResolvers) { argumentResolvers.add(new PrincipalArgumentResolver(authenticationService)); } @Override public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor(new RequestInterceptor(this.apiContext.getHelpersService().getLoggerService())); } }