123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112 |
- <?xml version="1.0" encoding="UTF-8"?>
- <beans xmlns="http://www.springframework.org/schema/beans"
- 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="false"/>
- <property name="testWhileIdle" value ="true"/>
- <property name="timeBetweenEvictionRunsMillis" value="60000" />
- <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
- <property name="minEvictableIdleTimeMillis" value="300000" />
-
- <!--每次检测时,需要检测多少个数据连接,一般设置为与最大连接数一样,这样就可以检测完所有的连接-->
- <property name="numTestsPerEvictionRun" value="20" />
- <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>
- <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>
- </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>
|