How can @ControllerAdvice be used to customize the response body of a global exception handler?

  • By extending @ControllerAdvice from a custom class.
  • By annotating the custom class with @ExceptionHandler.
  • By configuring the @ControllerAdvice annotation with custom media types.
  • By configuring the @ControllerAdvice annotation with @ResponseBodyAdvice classes.
@ControllerAdvice in Spring can be used to handle exceptions globally. To customize the response body, you can use @ControllerAdvice in combination with @ResponseBodyAdvice classes. These classes can customize the response format for specific exception types. The other options may be components used in the process but don't directly address customizing the response body.
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *