<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd">

    <!-- 配置FreeMarkerConfigurer -->
    <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
        <property name="templateLoaderPath" value="/WEB-INF/freemarker/"/>
        <property name="freemarkerSettings">
            <props>
                <prop key="template_update_delay">0</prop>
            </props>
        </property>
    </bean>

    <!--
      View resolvers can also be configured with ResourceBundles or XML files. If you need
      different view resolving based on Locale, you have to use the resource bundle resolver.
    -->
    <!-- freemarker视图解析器 -->
    <bean id="viewResolverFtl" class="org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver">
        <property name="suffix" value=".ftl"/>
        <property name="order" value="0"/>
        <property name="contentType" value="text/html;charset=UTF-8"/>
        <!-- 此变量值为pageContext.request, 页面使用方法：rc.contextPath -->
        <property name="requestContextAttribute" value="rc"/>
        <property name="cache" value="false"/>
    </bean>

    <!-- Convenient subclass of UrlBasedViewResolver that supports InternalResourceView
        (i.e. Servlets and JSPs) and subclasses such as JstlView. -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"
          abstract="false" lazy-init="default" autowire="default">
        <property name="viewClass">
            <value>org.springframework.web.servlet.view.JstlView</value>
        </property>
        <property name="prefix">
            <value>/WEB-INF/jsp_views/</value>
        </property>
        <property name="suffix">
            <value>.jsp</value>
        </property>
    </bean>

    <bean id="multipartResolver"
          class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
        <property name="defaultEncoding" value="UTF-8"/>
        <property name="uploadTempDir" value="tmp"></property>
        <property name="maxInMemorySize" value="4194304"/>
        <!-- 最大内存大小 -->
        <property name="maxUploadSize" value="4194304"/>
        <!-- 最大文件大小，1024*1024*4 = 4M -->
    </bean>

</beans>