I like SimpleMappingExceptionResolver, because in one place i have all exception->view mappings for all controllers in web-app (i suppose that). To customize some exception in specific controller i would like to use @ExceptionHandler, but it doesn't work together - all exceptions are handled by SimpleMappingExceptionResolver. How to make this work together ?
@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>