Spring MVC Exception Handling – @ControllerAdvice and @ExceptionHandler

In my previous article you would have learnt how to handle exception using @ExceptionHandler but that way of handling exceptions have a slight drawback as you have to write exception handling methods for each controller, suppose if you have 3 controllers each one should have its own exception handling methods. There no other way to have it globally. To overcome this, In Spring 3.2 they have introduced something called as @ControllerAdvice which acts a Global Exception Handler for all the controller you have. [Read more…]