将Controller抛出的异常转到特定View

<!-- 将Controller抛出的异常转到特定View -->
    <bean
        class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
        <!-- 定义默认的异常处理页面 -->
        <property name="defaultErrorView" value="error/500" />
        <!-- 定义异常处理页面用来获取异常信息的变量名,如果不添加exceptionAttribute属性,则默认为exception -->
        <property name="exceptionAttribute" value="exception" />
        <!-- 定义需要特殊处理的异常,用类名或完全路径名作为key,异常页面名作为值 -->
        <property name="exceptionMappings">
            <props>
                <prop key="com.test.core.exception.FuBusinessException">error/500</prop>
            </props>
        </property>
    </bean>
原文地址:https://www.cnblogs.com/james-roger/p/5864067.html