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

   
	<!-- 自动扫描且只扫描@Controller -->
	<context:component-scan base-package="com.house365"
		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:include-filter type="annotation" expression="org.aspectj.lang.annotation.Aspect"/>  --> 
	</context:component-scan>

	<context:property-placeholder
		ignore-resource-not-found="true" location="classpath*:/application.properties" />

	<mvc:annotation-driven conversion-service="conversionService">
		<mvc:message-converters register-defaults="true">
			<bean class="org.springframework.http.converter.StringHttpMessageConverter">
				<constructor-arg index="0" value="UTF-8" />
			</bean>
			<bean
				class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
		</mvc:message-converters>
	</mvc:annotation-driven>

	<bean id="conversionService"
		class="org.springframework.format.support.FormattingConversionServiceFactoryBean">
		<property name="converters">
			<set>
				<bean class="com.house365.converter.DateConverter" />
				<bean class="com.house365.converter.BooleanConverter" />
				<bean class="com.house365.converter.PermissionTypeConverter" />
			</set>
		</property>
	</bean>

	<!-- 将无法mapping到Controller的path交给default servlet handler处理 -->
	<mvc:default-servlet-handler />

	<mvc:interceptors>
		<mvc:interceptor>
			<mvc:mapping path="/**" />
			<bean class="com.house365.springmvc.interceptor.ParameterInterceptor" />
			<bean class="com.house365.web.interceptor.UrlParamAuthInterceptor" />
		</mvc:interceptor>
	</mvc:interceptors>

	<bean id="refererViewResolver" class="com.house365.springmvc.view.RefererViewResolver" />

	<!-- 定义JSP文件的位置 -->
	<bean
		class="org.springframework.web.servlet.view.InternalResourceViewResolver">
		<property name="prefix" value="/WEB-INF/views/" />
		<property name="suffix" value=".jsp" />
	</bean>

	<!-- 定义无Controller的path<->view直接映射 -->
	<mvc:view-controller path="/" view-name="redirect:/" />

	<mvc:resources mapping="/resources/**" location="/resources" cache-period="86400"/>
	<!--<mvc:resources mapping="/userPhoto/**" location="/userPhoto"/> -->
</beans>
