60 lines
2.9 KiB
XML
60 lines
2.9 KiB
XML
<?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:p="http://www.springframework.org/schema/p"
|
||
xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
|
||
xsi:schemaLocation="http://www.springframework.org/schema/beans
|
||
http://www.springframework.org/schema/beans/spring-beans-4.1.xsd
|
||
http://www.springframework.org/schema/context
|
||
http://www.springframework.org/schema/context/spring-context-4.1.xsd
|
||
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.1.xsd">
|
||
|
||
<bean id="SCADA_021HQWS" class="com.alibaba.druid.pool.DruidDataSource" init-method="init"
|
||
destroy-method="close">
|
||
<property name="driverClassName" value="${driver}" />
|
||
<property name="url" value="${scada-url}" />
|
||
<property name="username" value="${scada-username}" />
|
||
<property name="password" value="${scada-password}" />
|
||
|
||
<!-- 配置初始化大小、最小、最大 -->
|
||
<property name="initialSize" value="8" />
|
||
<property name="minIdle" value="5" />
|
||
<property name="maxActive" value="19" />
|
||
|
||
<!-- 配置获取连接等待超时的时间 -->
|
||
<property name="maxWait" value="30000" />
|
||
|
||
<!-- 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒 -->
|
||
<property name="timeBetweenEvictionRunsMillis" value="60000" />
|
||
|
||
<!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
|
||
<property name="minEvictableIdleTimeMillis" value="300000" />
|
||
|
||
<property name="testWhileIdle" value="true" />
|
||
|
||
<!-- 这里建议配置为TRUE,防止取到的连接不可用 -->
|
||
<property name="testOnBorrow" value="true" />
|
||
<property name="testOnReturn" value="false" />
|
||
|
||
<!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
|
||
<property name="poolPreparedStatements" value="true" />
|
||
<property name="maxPoolPreparedStatementPerConnectionSize"
|
||
value="20" />
|
||
|
||
<!-- 这里配置提交方式,默认就是TRUE,可以不用配置 -->
|
||
<property name="defaultAutoCommit" value="true" />
|
||
|
||
<!-- 验证连接有效与否的SQL,不同的数据配置不同 -->
|
||
<property name="validationQuery" value="select 1 " />
|
||
<!-- 开启Druid的监控统计功能,StatFilter可以和其他的Filter配置使用 -->
|
||
<property name="filters" value="stat"/>
|
||
|
||
<!-- proxyFilters属性配置,通过bean的方式配置 -->
|
||
<property name="proxyFilters">
|
||
<list>
|
||
<!-- <ref bean="log-filter"/>-->
|
||
</list>
|
||
</property>
|
||
</bean>
|
||
|
||
</beans>
|