16 package org.openkilda.northbound.config;
21 import org.springframework.boot.web.client.RestTemplateBuilder;
22 import org.springframework.context.annotation.Bean;
23 import org.springframework.context.annotation.Configuration;
24 import org.springframework.context.annotation.PropertySource;
25 import org.springframework.http.MediaType;
26 import org.springframework.http.converter.json.MappingJackson2HttpMessageConverter;
27 import org.springframework.web.client.RestTemplate;
28 import org.springframework.web.filter.OncePerRequestFilter;
29 import org.springframework.web.servlet.config.annotation.EnableWebMvc;
30 import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
31 import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
32 import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
34 import java.util.Collections;
41 @PropertySource({
"classpath:northbound.properties"})
42 public class WebConfig extends WebMvcConfigurerAdapter {
48 registry.addInterceptor(timeExecutionInterceptor());
49 registry.addInterceptor(extraAuthInterceptor());
72 RestTemplate restTemplate = builder.build();
73 MappingJackson2HttpMessageConverter converter =
new MappingJackson2HttpMessageConverter();
74 converter.setSupportedMediaTypes(Collections.singletonList(MediaType.APPLICATION_JSON));
75 restTemplate.getMessageConverters().add(converter);
87 registry.addResourceHandler(
"swagger-ui.html")
88 .addResourceLocations(
"classpath:/META-INF/resources/");
89 registry.addResourceHandler(
"/webjars/**")
90 .addResourceLocations(
"classpath:/META-INF/resources/webjars/");
ExecutionTimeInterceptor timeExecutionInterceptor()
void addInterceptors(InterceptorRegistry registry)
ExtraAuthInterceptor extraAuthInterceptor()
OncePerRequestFilter requestCorrelationIdFilter()
RestTemplate restTemplate(RestTemplateBuilder builder)
void addResourceHandlers(ResourceHandlerRegistry registry)