We have learnt how to handle exception using the Spring exception handling mechanism through my previous articles and we know how the @ControllerAdvice and @ExceptionHandler annotations works, how to handle exception globally. Now let's see how do we handle a User Defined Exception. … [Read more...]
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 … [Read more...]
Spring MVC Exception Handling – @ExceptionHandler
A good web application should have the perfect exception handling mechanism so that the user will not be rendered with any unhandled exception thrown. Spring MVC provides a great way to handle this exception with the help of @ExceptionHandler annotation. We simply have to annotate a method with @ExceptionHandler annotation and that method will be called automatically when the … [Read more...]