Table of contents
Flowchart when there is no SpringMVC global exception
SpringMVC global exception flow chart
It's actually a ModelAndView object
Configuration File
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 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"> <!-- The responsibility of scanning the controller is handed over to the dispatcher-servlet.xml, so exclude --> <context:exclude-filter type="annotation" expression="org.springframework.steretype.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>
dispatcher-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 scan package is specified to the controller to prevent repeated scans --> <context:component-scan base-package="com.mmall.controller" annotation-config="true" use-default-filters="false"> <context:include-filter type="annotation" expression="org.springframework.steretype.Controller"/> </context:component-scan> <mvc:annotation-driven> <mvc:message-converters> <bean> <property name="supportedMediaTypes"> <list><value>text/plain;charset=UTF-8</value> <value>text/html;charset=UTF-8</value> </list> </property> </bean> <bean> <property name="supportedMediaTypes"> <list> <value>application/json;charset=UTF-8</value> </list> </property> </bean> </mvc:message-converters> </mvc:annotation-driven> <mvc:interceptors> <!-- defined here, all of them will be intercepted--> <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 /> </mvc:interceptor> </mvc:interceptors></beans>
Summarize
The above is the entire content of this article. I hope that the content of this article has certain reference value for everyone's study or work. If you have any questions, you can leave a message to communicate. Thank you for your support to Wulin.com.