欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Spring MVC全局異常實(shí)例詳解

 更新時(shí)間:2018年02月19日 10:42:37   作者:芥末無(wú)疆sss  
這篇文章主要給大家介紹了關(guān)于Spring MVC全局異常的相關(guān)資料,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。

目錄

無(wú)SpringMVC全局異常時(shí)的流程圖


SpringMVC全局異常流程圖

其實(shí)是一個(gè)ModelAndView對(duì)象

配置文件

applicationcontext.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"xmlns:tx="http://www.springframework.org/schema/tx" xmlns:jdbc="http://www.springframework.org/schema/jdbc" xmlns:context="http://www.springframework.org/schema/context" xmlns:task="http://www.springframework.org/schema/task"  xsi:schemaLocation="http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
  http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
  http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
  http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
 <context:component-scan base-package="com.mmall">
  <!-- 掃描controller的職責(zé)交給dispatcher-servlet.xml,所以排除 -->
  <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
 </context:component-scan>
 <aop:aspectj-autoproxy/>
 <!-- spring schedule -->
 <context:property-placeholder location="classpath:datasource.properties"/>
 <task:annotation-driven/>
 <import resource="applicationContext-spring-session.xml"/>
 <import resource="applicationContext-datasource.xml"/>
</beans>

dispacher-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p"
xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc"xmlns:aop="http://www.springframework.org/schema/aop"xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
 http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
 http://www.springframework.org/schema/mvc
 http://www.springframework.org/schema/mvc/spring-mvc.xsd">
 <!-- springmvc掃描包指定到controller,防止重復(fù)掃描 -->
 <context:component-scan base-package="com.mmall.controller" annotation-config="true" use-default-filters="false">
  <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
 </context:component-scan>
 <mvc:annotation-driven>
  <mvc:message-converters>
   <bean class="org.springframework.http.converter.StringHttpMessageConverter">
    <property name="supportedMediaTypes">
     <list>
<value>text/plain;charset=UTF-8</value>
      <value>text/html;charset=UTF-8</value>
     </list>
    </property>
   </bean>
   <bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
    <property name="supportedMediaTypes">
     <list>
      <value>application/json;charset=UTF-8</value>
     </list>
    </property>
   </bean>
  </mvc:message-converters>
 </mvc:annotation-driven>
 <mvc:interceptors>
  <!-- 定義在這里的,所有的都會(huì)攔截-->
  <mvc:interceptor>
   <!--manage/a.do /manage/*-->
   <!--manage/b.do /manage/*-->
   <!--manage/product/save.do /manage/**-->
   <!--manage/order/detail.do /manage/**-->
   <mvc:mapping path="/manage/**"/>
   <!--<mvc:exclude-mapping path="/manage/user/login.do"/>-->
   <bean class="com.mmall.controller.common.interceptor.AuthorityInterceptor" />
  </mvc:interceptor>
 </mvc:interceptors>
</beans>

總結(jié)

以上就是這篇文章的全部?jī)?nèi)容了,希望本文的內(nèi)容對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,如果有疑問(wèn)大家可以留言交流,謝謝大家對(duì)腳本之家的支持。

相關(guān)文章

  • Transactional注解導(dǎo)致Spring Bean定時(shí)任務(wù)失效的解決方法

    Transactional注解導(dǎo)致Spring Bean定時(shí)任務(wù)失效的解決方法

    這篇文章主要介紹了Transactional注解導(dǎo)致Spring Bean定時(shí)任務(wù)失效的解決方法,文中通過(guò)代碼示例介紹的非常詳細(xì),對(duì)大家解決問(wèn)題有一定的幫助,需要的朋友可以參考下
    2024-10-10
  • 基于HTML5+js+Java實(shí)現(xiàn)單文件文件上傳到服務(wù)器功能

    基于HTML5+js+Java實(shí)現(xiàn)單文件文件上傳到服務(wù)器功能

    應(yīng)公司要求,在HTML5頁(yè)面上實(shí)現(xiàn)上傳文件到服務(wù)器功能,對(duì)于我這樣的菜鳥(niǎo),真是把我難住了,最后還是請(qǐng)教大神搞定的,下面小編把例子分享到腳本之家平臺(tái),供大家參考
    2017-08-08
  • java 中內(nèi)部類的實(shí)例詳解

    java 中內(nèi)部類的實(shí)例詳解

    這篇文章主要介紹了java 中內(nèi)部類的實(shí)例詳解的相關(guān)資料,希望通過(guò)本文能幫助到大家,需要的朋友可以參考下
    2017-09-09
  • JNDI,JTA和JMS簡(jiǎn)介

    JNDI,JTA和JMS簡(jiǎn)介

    這篇文章主要介紹了JNDI,JTA和JMS的相關(guān)內(nèi)容,包括中文釋義,概念解釋等,需要的朋友可以了解下。
    2017-09-09
  • Java算法實(shí)現(xiàn)楊輝三角的講解

    Java算法實(shí)現(xiàn)楊輝三角的講解

    今天小編就為大家分享一篇關(guān)于Java算法實(shí)現(xiàn)楊輝三角的講解,小編覺(jué)得內(nèi)容挺不錯(cuò)的,現(xiàn)在分享給大家,具有很好的參考價(jià)值,需要的朋友一起跟隨小編來(lái)看看吧
    2019-01-01
  • StringUtils里的isEmpty方法和isBlank方法的區(qū)別詳解

    StringUtils里的isEmpty方法和isBlank方法的區(qū)別詳解

    這篇文章主要介紹了StringUtils里的isEmpty方法和isBlank方法的區(qū)別詳解,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2020-04-04
  • java使用udp實(shí)現(xiàn)簡(jiǎn)單多人聊天功能

    java使用udp實(shí)現(xiàn)簡(jiǎn)單多人聊天功能

    這篇文章主要為大家詳細(xì)介紹了java使用udp實(shí)現(xiàn)簡(jiǎn)單多人聊天功能,文中示例代碼介紹的非常詳細(xì),具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2022-02-02
  • Spring Security OAuth2實(shí)現(xiàn)使用JWT的示例代碼

    Spring Security OAuth2實(shí)現(xiàn)使用JWT的示例代碼

    這篇文章主要介紹了Spring Security OAuth2實(shí)現(xiàn)使用JWT的示例代碼,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-09-09
  • 簡(jiǎn)單了解springboot eureka交流機(jī)制

    簡(jiǎn)單了解springboot eureka交流機(jī)制

    這篇文章主要介紹了簡(jiǎn)單了解springboot eureka交流機(jī)制,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友可以參考下
    2020-04-04
  • 使用jd-gui反編譯修改jar包里的.class并重新生成新jar問(wèn)題

    使用jd-gui反編譯修改jar包里的.class并重新生成新jar問(wèn)題

    這篇文章主要介紹了使用jd-gui反編譯修改jar包里的.class并重新生成新jar問(wèn)題,具有很好的參考價(jià)值,希望對(duì)大家有所幫助,如有錯(cuò)誤或未考慮完全的地方,望不吝賜教
    2024-05-05

最新評(píng)論