| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101 |
- <?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" destroy-method="close" init-method="init" class="com.alibaba.druid.pool.DruidDataSource"
- 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="testWhileIdle" value ="true"/>
- <property name="timeBetweenEvictionRunsMillis" value="30000" />
- <property name="numTestsPerEvictionRun" value="20" />
- <property name="initialSize" value="10"/>
- <property name="maxActive" value="20"/>
- <property name="maxIdle" value="0"/>
- <property name="maxWait" value="60000"/>
- <property name="minEvictableIdleTimeMillis" value="3600000"/> -->
-
- <property name="url" value="${dataSource.url}"/>
- <property name="username" value="${dataSource.username}"/>
- <property name="password" value="${dataSource.password}"/>
- <!-- 初始化连接大小 -->
- <property name="initialSize" value="0"/>
- <!-- 连接池最大使用连接数量 -->
- <property name="maxActive" value="20"/>
- <!-- 连接池最小空闲 -->
- <property name="minIdle" value="0"/>
- <!-- 获取连接最大等待时间 -->
- <property name="maxWait" value="60000"/>
- <property name="poolPreparedStatements" value="true"/>
- <property name="maxPoolPreparedStatementPerConnectionSize" value="33"/>
- <!-- 用来检测有效sql -->
- <property name="validationQuery" value="SELECT 1 from dual"/>
- <property name="testOnBorrow" value="false"/>
- <property name="testOnReturn" value="false"/>
- <property name="testWhileIdle" value="true"/>
- <!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
- <property name="timeBetweenEvictionRunsMillis" value="60000"/>
- <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
- <property name="minEvictableIdleTimeMillis" value="25200000"/>
- <!-- 打开removeAbandoned功能 -->
- <property name="removeAbandoned" value="true"/>
- <!-- 1800秒,也就是30分钟 -->
- <property name="removeAbandonedTimeout" value="1800"/>
- <!-- 关闭abanded连接时输出错误日志 -->
- <property name="logAbandoned" value="true"/>
- <!-- 监控数据库 -->
- <property name="filters" value="stat"/>
- </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 id="sqlSessionFactory" class="com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean">
- <property name="configLocation"
- value="WEB-INF/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 class="org.mybatis.spring.mapper.MapperScannerConfigurer">
- <property name="basePackage" value="com.minpay.db.table.mapper"/>
- </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>
|