码迷,mamicode.com
首页 > 编程语言 > 详细

spring 整合c3p0连接池

时间:2020-02-23 23:59:55      阅读:103      评论:0      收藏:0      [点我收藏+]

标签:pid   user   rem   val   group   prope   max   pen   --   


<!--pom.xml引入jar包-->
<dependency>
<groupId>com.mchange</groupId>
<artifactId>c3p0</artifactId>
<version>0.9.5.5</version>
</dependency>


<?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:context="http://www.springframework.org/schema/context" 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.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <context:property-placeholder location="classpath:db.properties"/> <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"> <property name="driverClass" value="${jdbc.driver}"/> <property name="jdbcUrl" value="${jdbc.jdbcUrl}"/> <property name="user" value="${jdbc.user}"/> <property name="password" value="${jdbc.password}"/> <property name="initialPoolSize" value="1" /> <property name="minPoolSize" value="0" /> <property name="maxPoolSize" value="10" /> <property name="acquireIncrement" value="5" /> <property name="maxIdleTime" value="10" /> <property name="maxStatements" value="0" /> </bean> <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <property name="mapperLocations" value="classpath:com/kuang/mapper/*.xml"/> <property name="typeAliases" value="com.kuang.pojo.User"/> </bean> <bean id="userMapper" class="com.kuang.mapper.UserMapperImpl"> <property name="sqlSessionFactory" ref="sqlSessionFactory"/> </bean> </beans>

 

spring 整合c3p0连接池

标签:pid   user   rem   val   group   prope   max   pen   --   

原文地址:https://www.cnblogs.com/gaoyangliu/p/12354981.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!