I like SimpleMappingExceptionResolver because in one place I have all the exceptions -> display mappings for all the controllers in the web application (I suppose that). To set up some kind of exception in a specific controller, I would like to use @ExceptionHandler , but it does not work together - all exceptions are handled by SimpleMappingExceptionResolver . How to make this work collaborative?
@Controller public class SomeController { ... @ExceptionHandler(SomeException.class) public ModelAndView handleException(Exception ex) {
SimpleMappingExceptionResolver:
<bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver"> <property name="defaultErrorView" value="error"/> <property name="exceptionMappings"> ... </property> </bean>
source share