spring-mvc.xml 4.17 KB
<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:tx="http://www.springframework.org/schema/tx"
	xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:mvc="http://www.springframework.org/schema/mvc"
	xmlns:p="http://www.springframework.org/schema/p"
	xmlns:util="http://www.springframework.org/schema/util"
	xsi:schemaLocation="http://www.springframework.org/schema/beans 
           	http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
           	http://www.springframework.org/schema/context
           	http://www.springframework.org/schema/context/spring-context-4.0.xsd
           	http://www.springframework.org/schema/tx
      			http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
           	http://www.springframework.org/schema/aop
           	http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
           	http://www.springframework.org/schema/mvc
           	http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
           	http://www.springframework.org/schema/util
           	http://www.springframework.org/schema/util/spring-util-2.0.xsd">

	<context:component-scan base-package="cn.runsa.portal.web.controller" use-default-filters="false">
		<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
		<context:include-filter type="annotation" expression="org.springframework.web.bind.annotation.ControllerAdvice" />
	</context:component-scan>
	
	<mvc:interceptors>
		<mvc:interceptor>
			<mvc:mapping path="/customer/restRegister" />
			<bean class="cn.runsa.portal.web.support.spring.PhoneCaptchaIntercepter"></bean>
		</mvc:interceptor>
	</mvc:interceptors>
	
	<mvc:annotation-driven conversion-service="conversionService">
		<mvc:message-converters register-defaults="true">
            <bean class="com.alibaba.fastjson.support.spring.FastJsonHttpMessageConverter" />
        </mvc:message-converters>
	</mvc:annotation-driven>
	
	<bean id="conversionService" class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
		<property name="converters">  
       		<list>  
            	<bean class="cn.runsa.portal.web.support.spring.StringToDateConverter"/>  
        	</list>  
    	</property>  
	</bean>
	
	<mvc:default-servlet-handler />
	
	<!-- 定义aspectj,(shiro依赖)-->
	<aop:aspectj-autoproxy proxy-target-class="true" />

	<!-- 默认controller  
	<mvc:view-controller path="/" view-name="index" />
	-->
	<bean class="org.springframework.web.servlet.view.ContentNegotiatingViewResolver">
		<property name="ignoreAcceptHeader" value="true" />
		<property name="defaultContentType" value="text/html" />
		<property name="mediaTypes">
			<map>
				<entry key="json" value="application/json" />
				<entry key="jsonp" value="application/javascript" />
				<entry key="xml" value="application/xml" />
			</map>
		</property>
		<property name="favorParameter" value="false" />
		<property name="viewResolvers">
			<list>
				<bean class="org.springframework.web.servlet.view.BeanNameViewResolver" />
				<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
					<property name="prefix" value="/WEB-INF/views/"></property>
					<property name="suffix" value=".jsp"></property>
				</bean>
			</list>
		</property>
		<property name="defaultViews">
			<list>
				<bean class="com.alibaba.fastjson.support.spring.FastJsonJsonView">
					<property name="SerializerFeature">
	            		<list>
	            			<value>WriteDateUseDateFormat</value>
	            			<value>DisableCircularReferenceDetect</value>
	            			<value>BrowserCompatible</value>
	            		</list>
            		</property>
				</bean>
				<bean class="cn.runsa.portal.web.support.spring.FastJsonJsonpView" />
			</list>
		</property>
	</bean>
	<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">  
        <property name="defaultEncoding" value="utf-8"></property>   
        <property name="maxUploadSize" value="10485760000"></property>  
        <property name="maxInMemorySize" value="40960"></property>  
   </bean>
</beans>