<?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: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/aop
       http://www.springframework.org/schema/aop/spring-aop.xsd
       http://www.springframework.org/schema/mvc 
       http://www.springframework.org/schema/mvc/spring-mvc.xsd">

	<!-- SpringMVC的配置文件，包含网站跳转逻辑的控制，配置 -->
<!--    <context:component-scan base-package="com.emr" use-default-filters="false">
       &lt;!&ndash; 只扫描控制器 &ndash;&gt;
       <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>-->
    <mvc:annotation-driven/>

    <!--自定义消息转换器-->
    <mvc:annotation-driven>
        <mvc:message-converters register-defaults="true">
            <bean class="org.springframework.http.converter.StringHttpMessageConverter">
                <constructor-arg index="0" value="utf-8"></constructor-arg>
            </bean>
        </mvc:message-converters>
    </mvc:annotation-driven>
    <aop:aspectj-autoproxy proxy-target-class="true"/>
    <!--<mvc:resources location="/static/" mapping="/img/**"></mvc:resources>-->
    <context:component-scan base-package="com.emr.controller,com.emr.annotation"/>
    <!-- 静态资源映射 -->
    <mvc:resources mapping="/static/**" location="/static/" />
    <!-- 当上面要访问的静态资源不包括在上面的配置中时，则根据此配置来访问 -->
    <mvc:default-servlet-handler />

    <!--配置视图解析器，方便页面返回  -->
    <bean id="jspViewResolver"
        class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="prefix" value="/WEB-INF/views/" />
        <property name="suffix" value=".jsp" />
    </bean>


    <bean id="configProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
        <property name="locations">
            <list>
                <value>classpath:/config/*.properties</value>
            </list>
        </property>
    </bean>
    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PreferencesPlaceholderConfigurer">
        <property name="properties" ref="configProperties"/>
    </bean>
    <mvc:interceptors>
        <mvc:interceptor>
            <mvc:mapping path="/**"/>
            <mvc:exclude-mapping path="/static/**"/>
            <bean class="com.emr.controller.UrlInterceptor"/>
        </mvc:interceptor>
    </mvc:interceptors>
</beans>