|
@@ -1,68 +1,112 @@
|
|
|
<?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:tx="http://www.springframework.org/schema/tx"
|
|
|
- xmlns:aop="http://www.springframework.org/schema/aop"
|
|
|
- xsi:schemaLocation="
|
|
|
- http://www.springframework.org/schema/beans
|
|
|
- http://www.springframework.org/schema/beans/spring-beans-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" >
|
|
|
+
|
|
|
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
|
+
|
|
|
+ xsi:schemaLocation="http://www.springframework.org/schema/beans
|
|
|
+
|
|
|
+ http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
|
|
|
+
|
|
|
+
|
|
|
|
|
|
|
|
|
+
|
|
|
<bean id="dataSource" name="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
|
|
|
+
|
|
|
scope="singleton">
|
|
|
+
|
|
|
<property name="driverClassName" value="${dataSource.driverClassName}" />
|
|
|
+
|
|
|
<property name="url" value="${dataSource.url}" />
|
|
|
+
|
|
|
<property name="username" value="${dataSource.username}"/>
|
|
|
+
|
|
|
<property name="password" value="${dataSource.password}"/>
|
|
|
+
|
|
|
<property name="validationQuery" value="SELECT 1 from dual"/>
|
|
|
- <property name="testOnBorrow" value="true"/>
|
|
|
+
|
|
|
+ <property name="testOnBorrow" value="false"/>
|
|
|
+
|
|
|
<property name="testWhileIdle" value ="true"/>
|
|
|
- <property name="timeBetweenEvictionRunsMillis" value="30000" />
|
|
|
+
|
|
|
+ <property name="timeBetweenEvictionRunsMillis" value="60000" />
|
|
|
+ <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
|
|
|
+ <property name="minEvictableIdleTimeMillis" value="300000" />
|
|
|
+
|
|
|
+ <!--每次检测时,需要检测多少个数据连接,一般设置为与最大连接数一样,这样就可以检测完所有的连接-->
|
|
|
<property name="numTestsPerEvictionRun" value="20" />
|
|
|
- <property name="initialSize" value="10"/>
|
|
|
- <property name="maxActive" value="10"/>
|
|
|
- <property name="maxWait" value="7000"/>
|
|
|
- </bean>
|
|
|
-
|
|
|
- <!--
|
|
|
- <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
|
|
|
- <property name="jndiName"> <value>jdbc/pay_ds</value> </property>
|
|
|
+
|
|
|
+ <property name="initialSize" value="10"/>
|
|
|
+
|
|
|
+ <property name="maxActive" value="20"/>
|
|
|
+
|
|
|
+ <property name="maxWait" value="60000"/>
|
|
|
+ <!--是否在数据库连接请求量大的时候,如总数50,当前已请求了49个,所剩不多了,检测那些执行时间久的连接-->
|
|
|
+ <property name="removeAbandoned" value="true"/>
|
|
|
+ <!--归还连接时执行validationQuery检测连接是否有效-->
|
|
|
+ <property name="testOnReturn" value="true" />
|
|
|
+
|
|
|
</bean>
|
|
|
- -->
|
|
|
-
|
|
|
- <!-- beware that mapper-config.xml is not needed if you use injected mappers -->
|
|
|
+
|
|
|
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"
|
|
|
+
|
|
|
scope="singleton" lazy-init="true">
|
|
|
+
|
|
|
<property name="configLocation"
|
|
|
+
|
|
|
value="classpath:com/startup/minpay/frame/jdbc/mybatisConfigure.xml"></property>
|
|
|
+
|
|
|
<property name="dataSource" ref="dataSource" />
|
|
|
+
|
|
|
<property name="mapperLocations">
|
|
|
+
|
|
|
<list>
|
|
|
+
|
|
|
<value>classpath:com/minpay/db/table/mapper/*.xml</value>
|
|
|
+
|
|
|
<value>classpath:com/minpay/db/table/own/mapper/*.xml</value>
|
|
|
- <!-- <value>classpath:com/minpay/db/procedure/mapper/*.xml</value> -->
|
|
|
+
|
|
|
</list>
|
|
|
+
|
|
|
</property>
|
|
|
+
|
|
|
<property name="typeAliasesPackage" value="com.minpay.db" />
|
|
|
+
|
|
|
</bean>
|
|
|
+
|
|
|
<bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"
|
|
|
+
|
|
|
scope="singleton" lazy-init="true">
|
|
|
+
|
|
|
<property name="basePackage" value="com.min.xxpro.db" />
|
|
|
+
|
|
|
</bean>
|
|
|
+
|
|
|
<bean id="transactionFactory"
|
|
|
+
|
|
|
class="org.apache.ibatis.transaction.jdbc.JdbcTransactionFactory"
|
|
|
+
|
|
|
scope="singleton" lazy-init="true"/>
|
|
|
+
|
|
|
<bean id="databaseManager" class="com.startup.minpay.frame.jdbc.MINDataBaseManager"
|
|
|
+
|
|
|
scope="singleton">
|
|
|
+
|
|
|
<constructor-arg>
|
|
|
+
|
|
|
<ref bean="sqlSessionFactory" />
|
|
|
+
|
|
|
</constructor-arg>
|
|
|
+
|
|
|
<constructor-arg>
|
|
|
+
|
|
|
<ref bean="transactionFactory" />
|
|
|
+
|
|
|
</constructor-arg>
|
|
|
+
|
|
|
</bean>
|
|
|
|
|
|
+
|
|
|
+
|
|
|
</beans>
|