If you want to handle exceptions from all of your controllers, you really should extend SimpleMappingExceptionResolver or, alternatively, AbstractHandlerExceptionResolver and configure it in the container, as indicated here .
This will prevent you (or other employees working in code) from having to subclass all controllers together with one place to eliminate exceptions.
Using annotations and a superclass will work, but the annotation seems to be more focused on using each controller.
In addition, both of these clauses only work for exceptions excluded from controller methods.
If you are worried about exceptions from .jsp files than this post , you should provide an additional solution.
None of the above replace the configuration of the web.xml error page, as their area is not the same. For discussion, this post seems like a good starting point.
source share