|
1 | 1 | package com.ooooo.config; |
2 | 2 |
|
| 3 | +import java.util.List; |
3 | 4 | import org.springframework.context.annotation.Bean; |
4 | 5 | import org.springframework.context.annotation.Configuration; |
5 | 6 | import org.springframework.core.convert.ConversionService; |
|
9 | 10 | import org.springframework.web.servlet.config.annotation.InterceptorRegistry; |
10 | 11 | import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; |
11 | 12 |
|
12 | | -import java.util.List; |
13 | | - |
14 | 13 | /** |
15 | 14 | * @author <a href="https://github.com/ooooo-youwillsee">ooooo</a> |
16 | 15 | * @since 2021/2/22 21:56 |
17 | 16 | */ |
18 | 17 | @Configuration |
19 | 18 | public class MvcConfigurer implements WebMvcConfigurer { |
20 | 19 |
|
21 | | - @Override |
22 | | - public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { |
23 | | - resolvers.add(0, xRequestBodyArgumentResolver(null, null)); |
24 | | - } |
25 | | - |
26 | | - @Override |
27 | | - public void addInterceptors(InterceptorRegistry registry) { |
28 | | - registry.addInterceptor(xRequestBodyHandlerInterceptor(null)); |
29 | | - } |
30 | | - |
31 | | - @Bean |
32 | | - public XRequestBodyArgumentResolver xRequestBodyArgumentResolver(List<HttpMessageConverter<?>> converters, ConversionService conversionService) { |
33 | | - return new XRequestBodyArgumentResolver(converters, conversionService); |
34 | | - } |
35 | | - |
36 | | - @Bean |
37 | | - public XRequestBodyHandlerInterceptor xRequestBodyHandlerInterceptor(MappingJackson2HttpMessageConverter messageConverter) { |
38 | | - return new XRequestBodyHandlerInterceptor(messageConverter); |
39 | | - } |
| 20 | + @Override |
| 21 | + public void addArgumentResolvers(List<HandlerMethodArgumentResolver> resolvers) { |
| 22 | + resolvers.add(0, xRequestBodyArgumentResolver(null, null)); |
| 23 | + } |
| 24 | + |
| 25 | + @Override |
| 26 | + public void addInterceptors(InterceptorRegistry registry) { |
| 27 | + registry.addInterceptor(xRequestBodyHandlerInterceptor(null)); |
| 28 | + } |
| 29 | + |
| 30 | + @Bean |
| 31 | + public XRequestBodyArgumentResolver xRequestBodyArgumentResolver(List<HttpMessageConverter<?>> converters, ConversionService conversionService) { |
| 32 | + return new XRequestBodyArgumentResolver(converters, conversionService); |
| 33 | + } |
| 34 | + |
| 35 | + @Bean |
| 36 | + public XRequestBodyHandlerInterceptor xRequestBodyHandlerInterceptor(MappingJackson2HttpMessageConverter messageConverter) { |
| 37 | + return new XRequestBodyHandlerInterceptor(messageConverter); |
| 38 | + } |
40 | 39 | } |
0 commit comments