title: How to keep ResponseBody on 204 No Content response?
body: <p>I want to return a <code>204 no content</code> http status code. Though I want to add a custom error messages that gives details <em>why</em> where was no content.</p>
  
  <p>Problem: I'm using <code>spring-mvc</code>, and when returning <code>HttpStatus.NO_CONTENT</code> type, the response body is always removed and empty for the client!</p>
  
  <pre><code>@RestControllerAdvice
  public class ExeptionHandler {
      @ExceptionHandler(Exception.class)
      @ResponseStatus(HttpStatus.NO_CONTENT)
      public Object handler(HttpServletRequest req, Exception e) {
          return new ResponseEntity&lt;String&gt;(e.getMessage(), HttpStatus.NO_CONTENT);
      }
  }
  </code></pre>
  
  <p>If I change the type eg to <code>HttpStatus.NOT_FOUND</code> then the error message is shown as response body.</p>
  
  <p>How can I achieve the same with 204?</p>