springboot配置c3p0数据源

1.再properties配置文件种配置:

c3p0.jdbcUrl=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=utf8&autoReconnect=true&failOverReadOnly=false
c3p0.user=root
c3p0.password=20140813
c3p0.driverClass=com.mysql.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

2.在pom.xml中添加c3p0的相关依赖:

springboot配置c3p0数据源_第1张图片


3.书写配置类:

springboot配置c3p0数据源_第2张图片

你可能感兴趣的:(springboot配置c3p0数据源)