<?xml version="1.0" encoding="UTF-8"?>
<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="http://www.springframework.org/schema/beans"
       xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
		http://www.springframework.org/schema/mvc
		http://www.springframework.org/schema/mvc/spring-mvc-4.1.xsd
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context-4.1.xsd
		http://www.springframework.org/schema/aop 
 		http://www.springframework.org/schema/aop/spring-aop-4.1.xsd">
    <!-- 自动扫描的包名 -->
    <context:component-scan base-package="com.house365.web.controller,com.house365.web.aop"/>
    <aop:aspectj-autoproxy proxy-target-class="true"/>

    <!-- 使用默认的Servlet来响应静态文件。 -->
    <!-- DispatcherServlet把找不到的请求映射到默认的servlet，从而实现处理静态资源的请求 -->
    <mvc:default-servlet-handler/>

    <!--  添加注解驱动 -->
    <mvc:annotation-driven/>


    <!-- 拦截器 -->
    <mvc:interceptors>
        <!-- 防止重复提交，请在页面添加"<house365:token/>" -->
        <!--
        <bean class="com.house365.web.system.interceptor.DenyDuplicateFormSubmitInterceptor" />
         -->
        <bean class="com.house365.web.interceptor.CommonParamsInterceptor"/>
        <!-- <bean class="com.house365.web.interceptor.UserTokenInterceptor" /> -->
        <bean class="com.house365.web.interceptor.LoginInterceptor"/>
        <bean class="com.house365.web.interceptor.UrlParamAuthInterceptor"/>

    </mvc:interceptors>

    <!-- 配置国际化拦截器 -->
    <bean id="localeChangeInterceptor" class="org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
        <property name="paramName" value="lang"/>
    </bean>

    <bean id="requestMappingHandlerMapping"
          class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping"/>

    <!-- 默认的controller
    <mvc:view-controller path="/" view-name="index" /> -->

    <!-- 配置视图解析器 -->
    <bean id="jstlViewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
        <property name="order" value="1"/>
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
        <property name="prefix" value="/WEB-INF/views/"/>
        <property name="suffix" value=".jsp"/>
    </bean>

    <context:property-placeholder ignore-unresolvable="true" location="classpath*:/properties/*.properties"/>

    <!-- 创建一个通用的多部分解析器 -->
    <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="defaultEncoding" value="UTF-8"/>
        <property name="maxUploadSize" value="20480000"/>
    </bean>
</beans>
