`
xurichusheng
  • 浏览: 335878 次
  • 性别: Icon_minigender_1
  • 来自: 南京
社区版块
存档分类
最新评论

Spring 配置文件--- 数据源配置(dbcp)

阅读更多

applicationContext.xml

 

<beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:aop="http://www.springframework.org/schema/aop"
     xmlns:tx="http://www.springframework.org/schema/tx"
     xmlns:context="http://www.springframework.org/schema/context"
     xsi:schemaLocation="
     http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
     http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
     http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
     http://www.springframework.org/schema/context 
	http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<!-- 数据库连接配置文件 -->
	<bean id="configBean" 
			class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
        <property name="location" value="classpath:jdbc.properties" />
	</bean>
<bean id="dataSource" 
		class="org.apache.commons.dbcp.BasicDataSource" 
		destroy-method="close">
		
		<property name="driverClassName" value="${driverClassName}" />
		<property name="username" value="${username}" />
		<property name="password" value="${password}" />
		<property name="url" value="${url}" />
		最大连接数量 
		<property name="maxActive" value="${maxActive}"/>
		最小空闲连接 数
		<property name="minIdle" value="${minIdle}"/>
		最大空闲连接数 
		<property name="maxIdle" value="${maxIdle}"/>
		初始化连接 数
		<property name="initialSize" value="${initialSize}"/>
		是否在自动回收超时连接的时候打印连接的超时错误  
		<property name="logAbandoned" value="${logAbandoned}"/>  
        	是否自动回收超时连接   
        <property name="removeAbandoned"  value="${removeAbandoned}"/>  
        	超时时间(以秒数为单位) 
        <property name="removeAbandonedTimeout" value="${removeAbandonedTimeout}"/>  
        	 超时等待时间(以毫秒为单位)    
        <property name="maxWait" value="${maxWait}"/>
	</bean>

</beans>
 

 

 

 

 

 

 

分享到:
评论

相关推荐

    Spring3中配置DBCP,C3P0,Proxool,Bonecp数据源

    在Spring3中配置数据源,包括DBCP,C3P0,Proxool,Bonecp主要的数据源,里面包含这些数据源的jar文件和依赖文件及配置文件。。 如Bonecp目前听说是最快的数据源,速度是传统的c3p0的25倍, bonecp.properties文件: ...

    apache 数据源(dbcp)资源包

    apache 数据源(dbcp)资源包,此包应用于spring的application.xml文件对数据源配置的资源包。 比较难找、但有一点:绝不能要分数--毕竟非稀有特色资源。 看到很多人要分、痛恨!!!!

    springMVC+JAP整合出去persistence.xml配置文件

    spring与jpa整合 除去persistence.xml配置文件 使用属性文件 数据源dbcp访问数据库

    基于框架的Web开发-使用springJDBC入门.doc

    (4) dbcp数据源:commons-dbcp、commons-pool (5) junit: junit、hamcrest (6) mysql 驱动 2 数据库准备 本章文件夹下有sampledb.sql文件,将其导入mysql中,会创建一个数据库sampledb,包含两张数据表。导入方法如...

    spring3.2+strut2+hibernate4

    &lt;description&gt;Spring公共配置文件 &lt;!-- 启用spring注解支持 --&gt; &lt;context:annotation-config /&gt; &lt;!-- &lt;bean id="sessionFactory"--&gt; &lt;!-- class="org.springframework.orm.hibernate3....

    ssh框架在application.xml中配置数据源所需jar

    --读取properties资源文件配置,如deploy.properties--&gt; class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;value&gt;classpath:/deploy.properties &lt;!--...

    springMVC+JAP整合彻底摆脱persistence.xml配置文件

    springMVC+JAP整合彻底摆脱persistence.xml配置文件 spring与jpa整合 除去persistence.xml配置文件 使用属性文件 数据源dbcp访问数据库.

    Spring的学习笔记

    一、 Sping配置数据源: 28 二、 注入使用 29 三、 dbcp.BasicDataSource 29 第十课 Spring整合Hiberante3 30 一、 Spring配置hibernate3的SessionFactory 30 (一) xml形式的SessionFactory 30 (二) annotation注解...

    Mybatis配置文件

    引入属性文件,注解扫描包,druid(德鲁伊)配置数据源 (c3p0 dbcp druid),监控数据库,配置sqlSessionFactory 将spring与mybatis结合,装配dao或mapper接口,拦截器方式配置事物——事务通知

    springmybatis

    1. 从配置文件(通常是XML配置文件中)得到 sessionfactory. 2. 由sessionfactory 产生 session 3. 在session 中完成对数据的增删改查和事务提交等. 4. 在用完之后关闭session 。 5. 在java 对象和 数据库之间有做...

    springmvcmybatis

    -- 引入配置文件 --&gt; class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer"&gt; &lt;!-- &lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-...

    spring2.5 学习笔记

    一、 Sping配置数据源: 28 二、 注入使用 29 三、 dbcp.BasicDataSource 29 第十课 Spring整合Hiberante3 30 一、 Spring配置hibernate3的SessionFactory 30 (一) xml形式的SessionFactory 30 (二) annotation注解...

    ssh(structs,spring,hibernate)框架中的上传下载

     由于Spring通过代理Hibernate完成数据层的操作,所以原Hibernate的配置文件hibernate.cfg.xml的信息也转移到Spring的配置文件中:  代码 4 Spring中有关Hibernate的配置信息 1. 2. !-- 数据源的配置 //--> 3. ...

    基于SSM架构实现的大型分布式购物网站-B2C项目源码+项目说明.zip

    - 1、配置数据源 - 2、让spring容器管理SqlSessionFactory,单例存在 - 3、把mapper的代理对象放到spring容器中。使用扫描包的方式加载mapper的代理对象。 ###Service层 - 1、事务管理 - 2、需要把service实现类放...

    ssh标准整合包(Oreacl数据库)

    ssh标准整合包 使用无使用jpa注解 使用hibernate配置文件 spring 注解 里面的包有55个 包括jstl 数据源dbcp

    zookeeper淘宝实现的监控

    l 节点自检:是指对集群中每个IP所在ZK节点上的PATH: /YINSHI.MONITOR.ALIVE.CHECK 定期进行三次如下流程 : 节点连接 – 数据发布 – 修改通知 – 获取数据 – 数据对比, 在指定的延时内,三次流程均成功视为该节点...

    Activiti6.0教程例子下载

    3.3. Spring配置文件 这里配置了数据源、事务管理、流程引擎及几个必要的xxxService。这里数据源使用的是dbcp。数据库信息就配置成你自己本地数据库的信息,如果不会配置。 ...

Global site tag (gtag.js) - Google Analytics