title: Get returnValue in ControllerAdvice
body: <p>I just created a controlleradvice in my spring boot application and trying to get return value object in the advice:</p>
  
  <pre><code>            @ControllerAdvice
          public class ResponseAdvice implements ResponseBodyAdvice&lt;Object&gt; {
  
  
              @Override
              public boolean supports(MethodParameter returnType, Class&lt;? extends HttpMessageConverter&lt;?&gt;&gt; converterType) {
                  return true;
              }
  
              @Override
              public Object beforeBodyWrite(Object body, MethodParameter returnType, MediaType selectedContentType,
                                            Class&lt;? extends HttpMessageConverter&lt;?&gt;&gt; selectedConverterType,
                                            ServerHttpRequest request, ServerHttpResponse response) {
  
                      response.setStatusCode(HttpStatus.OK);
                      int status = &lt;from returnValue&gt;;
                      return ResponseEntity.status(HttpStatus.valueOf(status)).body(body);
  
              }
          }
  </code></pre>
  
  <p>and in my controller:</p>
  
  <pre><code>return new ResponseEntity(HttpStatus.NO_CONTENT);
  </code></pre>
  
  <p>the logic here is always send 200 status code but inside the response we have actual status code:</p>
  
  <pre><code>{
      "headers": {},
      "body": {},
      "statusCode": "NO_CONTENT",
      "statusCodeValue": 201
  }
  </code></pre>
  
  <p>So my problem here is I don't know how I should access to returnValue in beforeBodyWrite method using returnType.
  When I am debugging in the IDE, I can see returnValue is added to returnType.</p>