123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990 |
- <?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:tx="http://www.springframework.org/schema/tx"
- xmlns:context="http://www.springframework.org/schema/context"
- xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:cache="http://www.springframework.org/schema/cache"
- xmlns:p="http://www.springframework.org/schema/p"
- xmlns:task="http://www.springframework.org/schema/task"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
- http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
- http://www.springframework.org/schema/cache http://www.springframework.org/schema/cache/spring-cache-3.1.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.2.xsd
- http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
- http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task-3.2.xsd">
- <!-- 扫描包,默认扫描所有 com.tqe下的所有注解 -->
- <context:component-scan base-package="com.tqe"/>
- <aop:aspectj-autoproxy />
- <bean
- class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping" />
- <!-- spring mvc请求映射 -->
- <bean
- class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">
- <property name="synchronizeOnSession" value="true"/>
- </bean>
- <!-- 导入mybatis的配置信息 -->
- <import resource="spring-mybatis.xml" />
- <!-- 配置拦截器 -->
- <mvc:interceptors>
- <mvc:interceptor>
- <mvc:mapping path="/admin/stuEval*" />
- <bean class="com.tqe.interceptor.StuEvalInterceptor"/>
- </mvc:interceptor>
- <mvc:interceptor>
- <mvc:mapping path="/admin/teaEval*" />
- <bean class="com.tqe.interceptor.TeaEvalInterceptor"/>
- </mvc:interceptor>
- </mvc:interceptors>
- <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" >
- <property name="messageConverters">
- <list>
- <bean class = "org.springframework.http.converter.StringHttpMessageConverter">
- <property name = "supportedMediaTypes">
- <list>
- <value>text/plain;charset=UTF-8</value>
- </list>
- </property>
- </bean>
- </list>
- </property>
- </bean>
- <!-- 配置responseBody 结果返回json数据 -->
- <bean id="jsonConverter"
- class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" >
- </bean>
- <!-- 全局异常处理 -->
- <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">
- <!-- 定义默认的异常处理页面,当该异常类型的注册时使用 -->
- <property name="defaultErrorView" value="error"/>
- <!-- 定义异常处理页面用来获取异常信息的变量名,默认名为exception -->
- <property name="exceptionAttribute" value="ex"/>
- <!-- 定义需要特殊处理的异常,用类名或完全路径名作为key,异常也页名作为值 -->
- <property name="exceptionMappings">
- <props>
- <!--<prop key="cn.basttg.core.exception.ParameterException">error-parameter</prop>-->
- <!-- 这里还可以继续扩展对不同异常类型的处理 -->
- </props>
- </property>
- </bean>
- </beans>
|