Added default view resolver to fix issue with swagger ui

This commit is contained in:
Jim Martens 2020-07-07 22:15:02 +02:00
parent 8c4e8b063d
commit 6a68afc62b
1 changed files with 25 additions and 19 deletions

View File

@ -10,6 +10,7 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import org.springframework.web.servlet.view.InternalResourceViewResolver;
import java.util.ArrayList;
import java.util.List;
@ -18,24 +19,29 @@ import java.util.List;
@Configuration
public class WebConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new TraceIdInterceptor());
registry.addInterceptor(new RequestTypeInterceptor());
}
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
List<ClientHttpRequestInterceptor> interceptors
= restTemplate.getInterceptors();
if (CollectionUtils.isEmpty(interceptors)) {
interceptors = new ArrayList<>();
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new TraceIdInterceptor());
registry.addInterceptor(new RequestTypeInterceptor());
}
@Bean
public InternalResourceViewResolver defaultViewResolver() {
return new InternalResourceViewResolver();
}
@Bean
public RestTemplate restTemplate() {
RestTemplate restTemplate = new RestTemplate();
List<ClientHttpRequestInterceptor> interceptors
= restTemplate.getInterceptors();
if (CollectionUtils.isEmpty(interceptors)) {
interceptors = new ArrayList<>();
}
interceptors.add(new TraceIdInterceptor());
interceptors.add(new RequestTypeInterceptor());
restTemplate.setInterceptors(interceptors);
return restTemplate;
}
interceptors.add(new TraceIdInterceptor());
interceptors.add(new RequestTypeInterceptor());
restTemplate.setInterceptors(interceptors);
return restTemplate;
}
}