激情久久久_欧美视频区_成人av免费_不卡视频一二三区_欧美精品在欧美一区二区少妇_欧美一区二区三区的

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

PHP教程|ASP.NET教程|Java|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|JavaScript|易語(yǔ)言|

服務(wù)器之家 - 編程語(yǔ)言 - Java - Spring MVC全局異常實(shí)例詳解

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

2021-04-05 13:43芥末無(wú)疆sss Java

這篇文章主要給大家介紹了關(guān)于Spring MVC全局異常的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧。

目錄

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

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

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

springmvc全局異常流程圖

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

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

配置文件

applicationcontext.xml

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
<?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

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?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à)值,如果有疑問大家可以留言交流,謝謝大家對(duì)服務(wù)器之家的支持。

原文鏈接:https://www.jianshu.com/p/64bb687ef1df

延伸 · 閱讀

精彩推薦
主站蜘蛛池模板: 又黄又爽又色无遮挡免费 | 看免费一级毛片 | 91九色网址| 北原夏美av| 国产99久久精品一区二区 | 成年人在线视频免费 | 欧美日韩亚洲国产精品 | 国产欧美在线观看不卡一 | 草妞视频| 国产亚洲精品久久久久5区 99精品视频在线 | 亚洲福利在线观看视频 | 91婷婷射 | 在线成人免费网站 | 欧美三级欧美成人高清www | 国产女同玩人妖 | 黄色av一区二区三区 | 国产乱色精品成人免费视频 | 精品一区二区三区在线观看国产 | 欧美精品久久久久久久久老牛影院 | 91精品国产综合久久久欧美 | 欧美国产一级片 | 久久久久在线观看 | 圆产精品久久久久久久久久久 | 国产亚洲精品综合一区 | 亚洲国产精久久久久久久 | 久久夜视频 | 国产99视频精品免视看9 | 娇妻被各种姿势c到高潮小说 | 精品成人免费一区二区三区 | 13一14毛片免费看 | 日日摸夜夜骑 | 永久免费av片在线观看全网站 | 九草网| 国产九九热 | 久久久久久久亚洲视频 | 调教小男生抽打尿孔嗯啊视频 | 日韩毛片网站 | 精品国产专区 | 日韩av在线网 | 高清国产午夜精品久久久久久 | 国产一级一区二区三区 |