三.統一異常處理器配置

在springmvc.xml配置統一異常處理器。

 

 

在web.xml中配置:

前端控制器知道全局異常處理器id爲handlerExceptionResolver

 

 

<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>

    <init-param>

      <param-name>contextConfigLocation</param-name>

      <param-value>classpath:spring/springmvc.xml</param-value>

    </init-param>

    <init-param>

      <param-name>detectAllHandlerExceptionResolvers</param-name>

     <param-value>false</param-value>

    </init-param>

  </servlet>

 

detectAllHandlerExceptionResolvers

屏蔽自動註冊異常處理器,固定使用bean的id爲handlerExceptionResolver的異常處理器。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章