/**
* Allows customizing the request before its body is read and converted into an
* Object and also allows for processing of the resulting Object before it is
* passed into a controller method as an {@code @RequestBody} or an
* {@code HttpEntity} method argument.
*
* <p>Implementations of this contract may be registered directly with the
* {@code RequestMappingHandlerAdapter} or more likely annotated with
* {@code @ControllerAdvice} in which case they are auto-detected.
*
* @author Rossen Stoyanchev
* @since 4.2
*/publicinterfaceRequestBodyAdvice{/**
* 拦截器的匹配条件
*
* @param methodParameter
* @param targetType
* @param converterType
* @return
*/booleansupports(MethodParameter methodParameter,Type targetType,Class<?extendsHttpMessageConverter<?>> converterType);/**
* 在读取和转换请求正文之前第二次调用
*
* @param inputMessage 请求参数 - 目标方法参数
* @param parameter
* @param targetType 目标类型,不一定与方法参数类型相同,例如对于HttpEntity<String>
* @param converterType 用于反序列化主体的转换器
* @return
* @throws IOException 异常
*/HttpInputMessagebeforeBodyRead(HttpInputMessage inputMessage,MethodParameter parameter,Type targetType,Class<?extendsHttpMessageConverter<?>> converterType)throwsIOException;}
/**
* Allows customizing the response after the execution of an {@code @ResponseBody}
* or a {@code ResponseEntity} controller method but before the body is written
* with an {@code HttpMessageConverter}.
*
* <p>Implementations may be registered directly with
* {@code RequestMappingHandlerAdapter} and {@code ExceptionHandlerExceptionResolver}
* or more likely annotated with {@code @ControllerAdvice} in which case they
* will be auto-detected by both.
*
* @param <T> the body type
* @author Rossen Stoyanchev
* @since 4.1
*/publicinterfaceResponseBodyAdvice<T>{/**
* 拦截器的匹配条件
*
* @param returnType
* @param converterType
* @return
*/booleansupports(MethodParameter returnType,Class<?extendsHttpMessageConverter<?>> converterType);/**
* @param body 返回体
* @param returnType 方法返回类型
* @param selectedContentType
* @param selectedConverterType
* @param request
* @param response
* @return
*/@NullableTbeforeBodyWrite(@NullableT body,MethodParameter returnType,MediaType selectedContentType,Class<?extendsHttpMessageConverter<?>> selectedConverterType,ServerHttpRequest request,ServerHttpResponse response);}