Interview questions
Question 90 of 254
FreeWhat is @ExceptionHandler and how does exception resolution work when it's used?
Exception Handling & Validation
@ExceptionHandler marks a method (either local to a controller, or inside a global @ControllerAdvice) as responsible for handling a specific exception type thrown during request processing — when that exception propagates up from a controller method, Spring's exception resolution machinery intercepts it before it becomes a raw 500 error, invokes the matching handler method, and uses its return value to build the actual HTTP response.
Intermediate5 min
