123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <?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:jdbc="http://www.springframework.org/schema/jdbc"
- xmlns:jee="http://www.springframework.org/schema/jee"
- xmlns:tx="http://www.springframework.org/schema/tx"
- xmlns:jpa="http://www.springframework.org/schema/data/jpa"
- xmlns:aop="http://www.springframework.org/schema/aop"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- xsi:schemaLocation="
- http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
- http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.1.xsd
- http://www.springframework.org/schema/jee http://www.springframework.org/schema/jee/spring-jee-3.1.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
- http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
- http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd"
- default-lazy-init="true">
-
- <!-- SpringMVC相关Bean配置 -->
- <context:component-scan base-package="com.*.web" />
- <context:annotation-config/>
- <!--可以完成日期自动转换功能-->
- <mvc:annotation-driven>
- <!-- SpringMVC下载器 -->
- <mvc:message-converters>
- <bean class="com.core.util.file.DownloadHttpMessageConverter" />
- </mvc:message-converters>
- </mvc:annotation-driven>
-
- <!-- 使用注解映射 -->
- <bean id="handlerMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
-
- <!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 -->
- <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" >
- <property name="messageConverters">
- <list>
- <ref bean="stringHttpMessageConverter"/>
- <ref bean="mappingJacksonHttpMessageConverter"/>
- </list>
- </property>
- </bean>
-
- <bean id="stringHttpMessageConverter" class="org.springframework.http.converter.StringHttpMessageConverter">
- <property name="supportedMediaTypes">
- <list>
- <value>text/plain;charset=UTF-8</value>
- </list>
- </property>
- </bean>
-
- <!-- 让controller 返回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>
-
- <!-- 对模型视图名称的解析,即在模型视图名称添加前后缀
- <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="redirectHttp10Compatible" value="false"/>
- <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
- <property name="contentType" value="text/html;charset=UTF-8" />
- <property name="prefix" value="/WEB-INF/view/" />
- <property name="suffix" value=".jsp" />
- </bean>
- -->
- <!-- FreeMarker视图解析 ,在这里配置后缀名ftl和视图解析器。。-->
- <bean id="freemarkerViewResolver" class="com.core.web.springmvc.RichFreeMarkerViewResolver">
- <property name="prefix" value="/view/"/>
- <property name="suffix" value=".jsp"/>
- <property name="contentType" value="text/html; charset=UTF-8"/>
- <property name="exposeRequestAttributes" value="false"/>
- <property name="exposeSessionAttributes" value="false"/>
- <property name="exposeSpringMacroHelpers" value="true"/>
-
- <!-- <property name="attributesMap">
- <map>
- <entry key="enum_show">
- <bean class="com.core.util.EnumValueShow"></bean>
- </entry>
- </map>
- </property> -->
- </bean>
- <!-- freemarker的配置 -->
- <bean id="freemarkerConfig" class="org.springframework.web.servlet.view.freemarker.FreeMarkerConfigurer">
- <property name="templateLoaderPath" value="/WEB-INF"/>
- <property name="freemarkerVariables">
- <map>
- <!--后台管理权限控制-->
- <entry key="pop_perm" value-ref="pop_perm"/>
- <entry key="enum_show" value-ref="enum_show" />
- </map>
- </property>
- <property name="freemarkerSettings">
- <props>
- <prop key="template_update_delay">0</prop>
- <prop key="defaultEncoding">UTF-8</prop>
- <prop key="url_escaping_charset">UTF-8</prop>
- <prop key="locale">zh_CN</prop>
- <prop key="boolean_format">true,false</prop>
- <prop key="datetime_format">yyyy-MM-dd HH:mm:ss</prop>
- <prop key="date_format">yyyy-MM-dd</prop>
- <prop key="time_format">HH:mm:ss</prop>
- <prop key="number_format">0.######</prop>
- <prop key="whitespace_stripping">true</prop>
- </props>
- </property>
- </bean>
-
- <!-- 让springmvc支持文件上传 -->
- <bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
- <property name="maxInMemorySize" value="2048"></property>
- <property name="maxUploadSize" value="1000000000"/>
- <property name="uploadTempDir" value="tmoDir"></property>
- </bean>
-
- <!--把标签定义包含进来-->
- <import resource="spring-directive.xml"/>
-
- </beans>
|