Druid数据源配置

<?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"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">  

<!-- Druid数据源配置并管理 -->
<bean id="dataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
    <property name="driverClassName" value="${db_driverClassName}"/>
    <property name="url" value="${db_url}" />
    <property name="username" value="${db_user}" />
    <property name="password" value="${db_passwd}" />
    <property name="dbType" value="oracle" />
    <!--  配置初始化大小、最小、最大 -->
    <property name="initialSize" value="10" />
    <property name="minIdle" value="10" />
    <property name="maxActive" value="100" />

    <!-- 获取连接等待超时时间 -->
    <property name="maxWait" value="60000" />

    <!-- 配置间隔多久进行空闲回收,单位是毫秒 -->
    <property name="timeBetweenEvictionRunsMillis" value="60000" />

    <!-- 配置一个连接在池中最小生存的时间,单位是毫秒 -->
    <property name="minEvictableIdleTimeMillis" value="300000" />
    <property name="validationQuery" value="SELECT 'x'" />
    <property name="testWhileIdle" value="true" />
    <property name="testOnBorrow" value="false" />
    <property name="testOnReturn" value="false" />

    <!-- 打开PSCache,并且指定每个连接上PSCache的大小 -->
    <property name="poolPreparedStatements" value="true" />
    <property name="maxPoolPreparedStatementPerConnectionSize" value="20" />
</bean>




<!-- Dao -->
<bean id="jdbcDaoImpl" class="com.npnets.dao.impl.JdbcDaoImpl">
    <property name="jdbcTemplate" ref="jdbcTemp"/>
</bean>
<bean id="agentDao" class="com.npnets.dao.impl.AgentDaoImpl">
    <property name="jdbcDao" ref="jdbcDaoImpl" />
</bean>
<bean id="web800Dao" class="com.npnets.dao.impl.Web800DaoImpl">
    <property name="jdbcDao" ref="jdbcDaoImpl"/>
</bean>

<!-- 业务层 -->
<bean id="web800Manager" class="com.npnets.service.impl.Web800ManagerImpl">
    <property name="jdbcDao" ref="jdbcDaoImpl" />
    <property name="agentDao" ref="agentDao" />
    <property name="web800Dao" ref="web800Dao" />
</bean>

<!-- 接口层 -->
<bean id="agentService" class="com.npnets.interfaces.impl.AgentServiceImpl">
    <property name="web800Manager" ref="web800Manager" />
</bean>
<bean id="web800Service" class="com.npnets.interfaces.impl.Web800ServiceImpl">
    <property name="web800Manager" ref="web800Manager"/>
</bean>

<!-- 系统信息 -->
<bean id="systemConfig" class="com.npnets.tools.SystemConfig">
    <property name="agentIp" value="${agent_ip}" />
    <property name="agentPort" value="${agent_port}" />
    <property name="web800Ip" value="${web800_ip}" />
    <property name="web800Port" value="${web800_port}" />
    <property name="listenerPort" value="${listener_Port}" />
    <property name="accphonenumber" value="${accphonenumber}" />
</bean>

<!-- 读取数据库配置文件/WEB-INF/classes/  -->
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="location" value="classpath:jdbc.properties"/>
</bean>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值