@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返回值
最新推荐文章于 2024-05-30 11:52:43 发布