Concept Flow - @ExceptionHandler in controllers
Controller method called
Exception thrown?
No→Return normal response
Yes
@ExceptionHandler method matches exception type?
No→Unhandled exception
Yes
@ExceptionHandler method runs
Return error response to client
When a controller method throws an exception, Spring looks for a matching @ExceptionHandler method to handle it and send a custom response.