摘要: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.
如果在pom文件里有spring-boot-starter-jdbc 或者 spring-boot-starter-data-jpa 依赖项,那么,会自动获取tomcat-jdbc连接池。