<?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:aop="http://www.springframework.org/schema/aop"
	   xmlns:context="http://www.springframework.org/schema/context"
	   xmlns:task="http://www.springframework.org/schema/task"
	   xmlns:cache="http://www.springframework.org/schema/cache"
	   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/aop
	http://www.springframework.org/schema/aop/spring-aop-4.0.xsd 
	http://www.springframework.org/schema/task 
	http://www.springframework.org/schema/task/spring-task.xsd
	http://www.springframework.org/schema/cache
	http://www.springframework.org/schema/cache/spring-cache.xsd">
	<!-- 管家收缴率 -->
	<context:component-scan
		base-package="com.salesforce"/>

	<!-- <cache:annotation-driven /> -->
	
	<!-- <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager"
		p:cache-manager-ref="ehcache" /> -->
	<!-- EhCache library setup -->
	<!-- <bean id="ehcache"
		class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean"
		p:config-location="classpath:ehcache.xml" p:shared="true" /> -->
		
	<aop:aspectj-autoproxy proxy-target-class="true" />

	<import resource="dataSource.xml" />
	<!-- 支持上传文件 -->
	<bean id="multipartResolver" class="org.springframework.web.multipart.commons.CommonsMultipartResolver">
		<property name="maxUploadSize" value="20971520" />
		<property name="defaultEncoding" value="UTF-8" />
		<property name="uploadTempDir" value="uploadFile" />
	</bean>

	<bean id="applicationProperties"
		  class="org.springframework.beans.factory.config.PropertiesFactoryBean">
		<property name="locations">
			<list>
				<value>classpath:/application.properties</value>
			</list>
		</property>
	</bean>
	
	<bean id="cacheManagerFactory" class="org.springframework.cache.ehcache.EhCacheManagerFactoryBean">  
        <property name="configLocation" value="classpath:spring/ehcache.xml"/>  
    </bean>  
    <bean id="cacheManager" class="org.springframework.cache.ehcache.EhCacheCacheManager">  
        <property name="cacheManager" ref="cacheManagerFactory"/>  
    </bean> 

	<cache:annotation-driven/>
	
	<!--短信管理器-->
	<bean id="smsBaseManager" class="cn.com.countrygarden.bi.main.sms.SmsBaseManager">
		<constructor-arg name="appkey" value="${sms.appkey}"/>
		<constructor-arg name="appSecret" value="${sms.appSecret}"/>
		<constructor-arg name="appUrl" value="${sms.appUrl}"/>
		<constructor-arg name="appPersonUrl" value="${sms.personnel.appUrl}"/>
		
	</bean>
	<!--短信同步客户端-->
	<bean id="syncApiClientSmsService"
		  factory-bean="smsBaseManager"
		  factory-method="getSyncClientInstance"
		  class="cn.com.countrygarden.bi.main.sms.client.SyncApiClientSmsService"/>
	<!--短信异步客户端-->
	<bean id="asyncApiClientSmsService"
		  factory-bean="smsBaseManager"
		  factory-method="getASyncClientInstance"
		  class="cn.com.countrygarden.bi.main.sms.client.AsyncApiClientSmsService"/>

	<!-- spring thread pool executor -->
	<bean id="taskExecutor" class="org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor">
		<property name="corePoolSize" value="10" />
		<property name="keepAliveSeconds" value="200" />
		<property name="maxPoolSize" value="15" />
		<property name="queueCapacity" value="20" />
		<property name="rejectedExecutionHandler">
			<bean class="java.util.concurrent.ThreadPoolExecutor$CallerRunsPolicy" />
		</property>
	</bean>

</beans> 	
