Spring MVC Framework provides following mechanisms to help us
achieve exception handling:
Controller Based: A developer can define exception handler
methods in a Controller class. To do so, they have to annotate the
methods with @ExceptionHandler annotation.
Global Exception Handler: Spring provides @ControllerAdvice
annotation for exception handling as cross-cutting concern. We can
mark any class as global exception handler by using this annotation.
HandlerExceptionResolver implementation: Spring Framework
provides HandlerExceptionResolver interface that can be
implemented to create a global exception handler.