<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-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/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.2.xsd ">
<!-- 开启注解 -->
<mvc:annotation-driven></mvc:annotation-driven>
<!-- 解析静态文件 -->
<mvc:default-servlet-handler />
<mvc:resources location="/admin/" mapping="/admin/**" />
<mvc:resources location="/business/" mapping="/business/**" />
<mvc:resources location="/css/" mapping="/css/**" />
<mvc:resources location="/data/" mapping="/data/**" />
<mvc:resources location="/dls/" mapping="/dls/**" />
<mvc:resources location="/images/" mapping="/images/**" />
<mvc:resources location="/js/" mapping="/js/**" />
<mvc:resources location="/lib/" mapping="/lib/**" />
<mvc:resources location="/news/" mapping="/news/**" />
<mvc:resources location="/pages/" mapping="/pages/**" />
<mvc:resources location="/*.html" mapping="/*.html" />
<!-- 文件上传 设置上传最大尺寸,默认编码-->
<bean id="multipartResolver"
class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
<property name="maxUploadSize">
<value>5242880</value>
</property>
<property name="defaultEncoding">
<value>UTF-8</value>
</property>
</bean>
<!-- 避免返回为json类型出现下载的状况 -->
<bean id="mappingJacksonHttpMessageConverter"
class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/html;charset=UTF-8</value>
</list>
</property>
</bean>
<mvc:interceptors>
<!-- 管理员登陆拦截器 不包含某些路径,这里的 exclude 并不仅限于url,也可以是一个请求-->
<mvc:interceptor>
<mvc:mapping path="/post/admin/**"/>
<mvc:exclude-mapping path="/post/admin/login"/>
<mvc:exclude-mapping path="/post/admin/getSession"/>
<bean class="com..interceptor.AdminSessionCheckInterceptor"/>
</mvc:interceptor>
<!-- 用户拦截器 -->
<mvc:interceptor>
<mvc:mapping path="/post/**"/>
<mvc:exclude-mapping path="/post/admin/**"/>
<!-- <mvc:exclude-mapping path="/business/regInfo.html"/> -->
<mvc:exclude-mapping path="/post/memberLogin"/> <!-- 用户登录 -->
<mvc:exclude-mapping path="/post/getMemberSession"/><!-- 获取session -->
<mvc:exclude-mapping path="/post/checkMember"/> <!-- 检查用户名是否存在 -->
<mvc:exclude-mapping path="/business/regInfo.html"/><!-- 用户注册页面 -->
<mvc:exclude-mapping path="/post/regist"/> <!-- 用户注册请求 -->
<mvc:exclude-mapping path="/post/uploadPic"/>
<mvc:exclude-mapping path="/post/uploadTagExcelFile"/>
<mvc:exclude-mapping path="/post/processUpload"/> <!-- 不拦截 上传图片 -->
<bean class="com.interceptor.MemberSessionCheckInterceptor"/><!--这里是进行session检查-->
</mvc:interceptor>
</mvc:interceptors>
<!-- 全局异常 需要实现 HandlerExceptionResolver 接口-->
<bean class="com.exception.CommonsExceptionResolve" lazy-init="false"/>
<!-- 视图解析器 -->
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver" >
<!-- 返回路径前缀 -->
<property name="prefix" value="/"/>
<!-- 返回路径后缀 可以是jsp注意前面有 "." -->
<property name="suffix" value=".html"/>
</bean>
</beans>