SpringMVC 异常处理

a.为当前Controller配置错误处理

b.配置全局的错误处理

 

c.通过配置文件方式实现全局错误处理

    <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
        <property name="exceptionMappings">
            <props>
                <prop key="java.lang.ArithmeticException">error</prop>
            </props>
        </property>
    </bean>
原文地址:https://www.cnblogs.com/chuijingjing/p/9849651.html