You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.6 KiB
Java
44 lines
1.6 KiB
Java
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<HandlerMethodArgumentResolver> argumentResolvers) {
|
|
argumentResolvers.add(new PrincipalArgumentResolver(authenticationService));
|
|
}
|
|
|
|
@Override
|
|
public void addInterceptors(InterceptorRegistry registry) {
|
|
registry.addInterceptor(new RequestInterceptor(this.apiContext.getHelpersService().getLoggerService()));
|
|
}
|
|
|
|
}
|