@ControllerAdvice
public class ResponseBodyAnalysis implements ResponseBodyAdvice<Object> {
@Override
public boolean supports(MethodParameter returnType, Class<? extends HttpMessageConverter<?>> converterType) {
return true;
}
@Override
public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType, Class<? extends HttpMessageConverter<?>> selectedConverterType, ServerHttpRequest request, ServerHttpResponse response) {
System.out.println(body);
return body;
}
}
springboot拦截responseBody返回值
最新推荐文章于 2022-12-03 11:10:44 发布