<?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:tx="http://www.springframework.org/schema/tx" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
	xmlns:task="http://www.springframework.org/schema/task"
	xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.2.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/data/jpa 
http://www.springframework.org/schema/data/jpa/spring-jpa-1.2.xsd 
http://www.springframework.org/schema/task 
http://www.springframework.org/schema/task/spring-task.xsd
">
	<!-- 引入属性文件 <context:property-placeholder location="classpath:jdbc.properties" 
		/> -->

	<!-- 自动扫描dao和service包(自动注入) -->
	<context:component-scan base-package="cn.com.qmth.stmms.biz" />

	<import resource="spring-jpa.xml" />

	<!-- dbcp数据源 -->
	<bean name="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
		destroy-method="close">
		<property name="driverClassName" value="${driverClassName}"></property>
		<property name="url" value="${url}"></property>
		<property name="username" value="${username}"></property>
		<property name="password" value="${password}"></property>
		<property name="minEvictableIdleTimeMillis" value="1800000" />
		<property name="numTestsPerEvictionRun" value="3" />
		<property name="testOnBorrow" value="true" />
		<property name="validationQuery" value="SELECT 1" />
	</bean>

	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
		<property name="entityManagerFactory" ref="entityManagerFactory" />
	</bean>

	<!-- 指定事务声明的配置方式：使用注解的方式 -->
	<tx:annotation-driven transaction-manager="transactionManager" />

	<bean id="entityManagerFactory"
		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
		<property name="dataSource" ref="dataSource" />
		<property name="jpaVendorAdapter">
			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
				<property name="database" value="MYSQL" />
				<property name="showSql" value="false" />
				<property name="generateDdl" value="true" />
			</bean>
		</property>
	</bean>

	<task:executor id="stmms-executor" pool-size="10" />
	<task:annotation-driven executor="stmms-executor" />
</beans>