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

44 lines
1.6 KiB
Java
Raw Normal View History

2017-12-15 17:57:41 +01:00
package eu.eudat.configurations;
2018-03-05 17:18:45 +01:00
import eu.eudat.controllers.interceptors.RequestInterceptor;
2017-12-15 17:57:41 +01:00
import eu.eudat.handlers.PrincipalArgumentResolver;
2018-03-05 17:18:45 +01:00
import eu.eudat.services.ApiContext;
import eu.eudat.services.operations.AuthenticationService;
import eu.eudat.services.operations.AuthenticationServiceImpl;
import eu.eudat.types.WarningLevel;
2017-12-19 10:02:25 +01:00
import org.springframework.beans.factory.annotation.Autowired;
2017-12-15 17:57:41 +01:00
import org.springframework.context.annotation.Configuration;
2018-02-07 10:56:30 +01:00
import org.springframework.scheduling.annotation.EnableAsync;
2017-12-15 17:57:41 +01:00
import org.springframework.web.method.support.HandlerMethodArgumentResolver;
2018-03-05 17:18:45 +01:00
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
2017-12-15 17:57:41 +01:00
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
import java.util.List;
2018-02-07 10:56:30 +01:00
@EnableAsync
2017-12-15 17:57:41 +01:00
@Configuration
public class WebMVCConfiguration extends WebMvcConfigurerAdapter {
2018-03-05 17:18:45 +01:00
private ApiContext apiContext;
private AuthenticationService authenticationService;
2017-12-19 10:02:25 +01:00
@Autowired
2018-03-05 17:18:45 +01:00
public WebMVCConfiguration(ApiContext apiContext, AuthenticationService authenticationService) {
this.apiContext = apiContext;
this.authenticationService = authenticationService;
}
2018-02-16 11:34:02 +01:00
2018-03-05 17:18:45 +01:00
@Autowired
2017-12-15 17:57:41 +01:00
@Override
public void addArgumentResolvers(List<HandlerMethodArgumentResolver> argumentResolvers) {
2018-03-05 17:18:45 +01:00
argumentResolvers.add(new PrincipalArgumentResolver(authenticationService));
}
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new RequestInterceptor(this.apiContext.getHelpersService().getLoggerService()));
2017-12-15 17:57:41 +01:00
}
2018-01-17 13:03:51 +01:00
2017-12-15 17:57:41 +01:00
}