springboot数据库连接池使用策略

springboot官方文档介绍数据库连接池的使用策略如下:

Production database connections can also be auto-configured using a
pooling DataSource. Here’s the algorithm for choosing a specific
implementation:
We prefer the Tomcat pooling DataSource for its performance and concurrency, so if that is available we always choose it.
If HikariCP is available we will use it.
If Commons DBCP is available we will use it, but we don’t recommend it in production.
Lastly, if Commons DBCP2 is available we will use it.
If you use the spring-boot-starter-jdbc or spring-boot-starter-data-jpa ‘starter
POMs’ you will automatically get a dependency to tomcat-jdbc.

  1. springboot会优先使用tomcat连接池,因为其性能和并发性很好,如果可用的话,将会优先使用。tomcat连接池,请查看: http://tomcat.apache.org/tomcat-8.0-doc/jdbc-pool.html
  2. 如果HikariCP可用,会选择使用 http://brettwooldridge.github.io/HikariCP/
  3. 如果DBCP可用,会选择使用,但是不推荐在在先生产品使用它。
  4. 最后,如果使用DBCP2,会选择使用

    如果在pom文件里有spring-boot-starter-jdbc 或者 spring-boot-starter-data-jpa 依赖项,那么,会自动获取tomcat-jdbc连接池。

好像没有提到c3po?

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值