<?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">
		
	<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="fileEncoding" value="utf-8" />
		<property name="locations">
			<list>
				<value>classpath*:jdbc.properties</value>
			</list>
		</property>
	</bean>

	<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*:mybatis-mapper/*.xml"/>
	</bean>
    
    <!-- scope must be "prototype" when junit -->
    <bean id="sqlSessionTemplate"  class="org.mybatis.spring.SqlSessionTemplate" scope="prototype">  
          <constructor-arg index="0" ref="sqlSessionFactory" />  
    </bean> 
	
</beans>