<?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"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       https://www.springframework.org/schema/context/spring-context.xsd
       http://www.springframework.org/schema/mvc
       http://www.springframework.org/schema/mvc/spring-mvc.xsd">
<!--    controller组件扫描-->
<!--    <context:component-scan base-package="com.controller"></context:component-scan>-->
<!--    只扫描 com下的@Controller注解-->
    <context:component-scan base-package="com">
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
    </context:component-scan>

<!--    <mvc:annotation-driven></mvc:annotation-driven>-->
<!--    配置内部资源解析器-->
        <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/template/"></property>
            <property name="suffix" value=".jsp"></property>
        </bean>
<!--       <mvc:interceptors>-->
<!--           <mvc:interceptor>-->
<!--               <mvc:mapping path="/save"/>-->
<!--               <bean class="com.interceptor.MyInterceptor2"></bean>-->
<!--           </mvc:interceptor>-->
<!--       </mvc:interceptors>-->
<!--    <bean class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter">-->
<!--        <property name="messageConverters">-->
<!--            <list>-->
<!--                <bean class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter"/>-->
<!--            </list>-->
<!--        </property>-->

<!--    </bean>-->
<!--            <mvc:annotation-driven></mvc:annotation-driven>-->
        <mvc:annotation-driven conversion-service="conversionService"></mvc:annotation-driven>
        <!--  开放静态资源的访问-->
        <mvc:resources mapping="/js/**" location="/js/"></mvc:resources>
<!--        声明转换器-->
        <bean id="conversionService" class="org.springframework.context.support.ConversionServiceFactoryBean">
            <property name="converters">
                <list>
                    <bean class="com.converter.DateConverter"></bean>
                </list>
            </property>
        </bean>
<!--        配置文件上传解析器-->
        <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
            <property name="defaultEncoding" value="UTF-8"></property>
        </bean>
<!--        配置简单映射异常处理器器-->
<!--        <bean class="org.springframework.web.servlet.handler.SimpleMappingExceptionResolver">-->
<!--&lt;!&ndash;            <property name="defaultErrorView" value="error"></property>&ndash;&gt;-->
<!--            <property name="exceptionMappings">-->
<!--                <map>-->
<!--                    <entry key="java.lang.RuntimeException" value="runtime_error"></entry>-->
<!--                    <entry key="com.exception.MyException" value="my_error"></entry>-->
<!--                </map>-->
<!--            </property>-->
<!--        </bean>-->
</beans>