<?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:aop="http://www.springframework.org/schema/aop" xmlns:tx="http://www.springframework.org/schema/tx"
	xsi:schemaLocation="
		http://www.springframework.org/schema/beans 
		http://www.springframework.org/schema/beans/spring-beans-3.0.xsd 
		http://www.springframework.org/schema/context 
		http://www.springframework.org/schema/context/spring-context-3.0.xsd 
		http://www.springframework.org/schema/aop 
		http://www.springframework.org/schema/aop/spring-aop-3.0.xsd 
		http://www.springframework.org/schema/tx 
		http://www.springframework.org/schema/tx/spring-tx-3.0.xsd">
		
	<context:annotation-config />
	<context:component-scan base-package="com.xxl.service.impl, com.xxl.dao.impl" />

	<!-- c3p0：Main数据源  -->
	<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"  destroy-method="close">  
	    <property name="driverClass" value="${c3p0.driverClass}" />  
	    <property name="jdbcUrl" value="${c3p0.url}" />  
	    <property name="user" value="${c3p0.user}" />  
	    <property name="password" value="${c3p0.password}" />  
	    <property name="initialPoolSize" value="3" />  
	    <property name="minPoolSize" value="2" />  
	    <property name="maxPoolSize" value="10" />  
	    <property name="maxIdleTime" value="60" />
	    <property name="acquireRetryDelay" value="1000" />
	    <property name="acquireRetryAttempts" value="10" />
	    <property name="preferredTestQuery" value="SELECT 1" />
	</bean>
	
	<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="mapperLocations" value="classpath*:com/xxl/core/model/mapper/*.xml"/>
	</bean>
    
    <!-- Template在Junit测试的时候，必须使用scope="prototype"，原因未知 -->
    <bean id="sqlSessionTemplate"  class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">  
          <constructor-arg index="0" ref="sqlSessionFactory" />  
    </bean> 
	
</beans>