45fan.com - 路饭网

搜索: 您的位置主页 > 网络频道 > 阅读资讯:怎么样在spring中进行连接池使用c3p0配置参考代码?

怎么样在spring中进行连接池使用c3p0配置参考代码?

2016-09-03 10:42:58 来源:www.45fan.com 【

怎么样在spring中进行连接池使用c3p0配置参考代码?

<?xmlversion="1.0"encoding="UTF-8"?>
<!DOCTYPEbeansPUBLIC"-//SPRING//DTDBEAN//EN"
"http://www.springframework.org/dtd/spring-beans.dtd"
>
<beans>
<beanid="propertyConfigurer"class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<propertyname="location">
<value>classpath:jdbc.properties</value>
</property>
</bean>

<beanid="c3p0DataSource"class="com.mchange.v2.c3p0.ComboPooledDataSource"
destroy-method="close">
<propertyname="driverClass">
<value>${db.driverClass}</value>
</property>
<propertyname="jdbcUrl">
<value>${db.url}</value>
</property>
<propertyname="properties">
<props>
<propkey="c3p0.acquire_increment">5</prop>
<propkey="c3p0.idle_test_period">100</prop>
<propkey="c3p0.max_size">100</prop>
<propkey="c3p0.max_statements">0</prop>
<propkey="c3p0.min_size">10</prop>
<propkey="user">${db.user}</prop>
<propkey="password">${db.pass}</prop>
</props>
</property>
</bean>

<beanid="sessionFactory"class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<propertyname="hibernateProperties">
<props>
<propkey="hibernate.dialect">${hibernate.dialect}</prop>
<propkey="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
<propertyname="dataSource"ref="c3p0DataSource"/>
<propertyname="annotatedClasses"value="martin.dwr.demo.model.User"/>
</bean>

<beanid="userDao"class="martin.dwr.demo.dao.hibernate.HibernateUserDAO">
<propertyname="sessionFactory"ref="sessionFactory"/>
</bean>
</beans>
 

本文地址:http://www.45fan.com/a/question/71641.html
Tags: 进行 Spring c3p0
编辑:路饭网
关于我们 | 联系我们 | 友情链接 | 网站地图 | Sitemap | App | 返回顶部