zoukankan      html  css  js  c++  java
  • springboot整合成c3p0

    一,pom文件

         <dependency>
                <groupId>com.mchange</groupId>
                <artifactId>c3p0</artifactId>
                <version>0.9.5.4</version>
            </dependency>

    二,配置文件

    c3p0.jdbcUrl=jdbc:mysql://x.x.x.x:xx/xxx?useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC&&serverTimezone=Asia/Shanghai
    c3p0.user=root
    c3p0.password=123456
    c3p0.driverClass=com.mysql.cj.jdbc.Driver
    c3p0.minPoolSize=2
    c3p0.maxPoolSize=10
    c3p0.maxIdleTime=1800000
    c3p0.acquireIncrement=3
    c3p0.maxStatements=1000
    c3p0.initialPoolSize=3
    c3p0.idleConnectionTestPeriod=60
    c3p0.acquireRetryAttempts=30
    c3p0.acquireRetryDelay=1000
    c3p0.breakAfterAcquireFailure=false
    c3p0.testConnectionOnCheckout=false

    配置类

    @Configuration
    public class DataSourceConfig {
        @Bean(name = "dataSource")
        @Qualifier(value = "dataSource")
        @Primary
        @ConfigurationProperties(prefix = "c3p0")
        public DataSource dataSource()
        {
            return DataSourceBuilder.create().type(com.mchange.v2.c3p0.ComboPooledDataSource.class).build();
        }
    }
  • 相关阅读:
    jQuery火箭图标返回顶部代码
    质数和分解(完全背包)
    CodeForces
    FZU
    FZU
    Pets(匈牙利算法)
    Construct a Matrix (矩阵快速幂+构造)
    绝世好题(线性dp)
    String painter (区间dp)
    Funny Positive Sequence (思维+前缀)
  • 原文地址:https://www.cnblogs.com/sh-0131/p/12877836.html
Copyright © 2011-2022 走看看