This annotation marks a handler method or exception class with the status code() and reason() that should be returned.
The status code is applied to the HTTP response when the handler method is invoked and overrides status information set by other means, like ResponseEntity or "redirect:".
When using @ResponseStatus on an exception class, the HttpServletResponse#sendError(int statusCode, java.lang.String reasonMsg) method will be used instead of ResponseStatus#reson()
This annotation can also be used on a controller class level and is then applied to all @RequestMapping handler methods.