Spring MVC Exceptional Handling using @ExceptionHandler example

In this post , we will see how to do exceptional handling in Spring MVC using @ExceptionalHandler. You can use @ExceptionHandler to redirect to error view when exception occurs.
Lets understand this with the help of example:

4) create a xml file named springrest-servlet.xml in /WEB-INF/ folder.Please change context:component-scan if you want to use different package for spring to search for controller.Please refer to spring mvc hello world example for more understanding.