Reputation: 411
I was trying to find out the Hikari connection properties to set with my Spring boot 2.4.0 app with MySQL 8.0. This took me for a while to browse through various posts but couldn't find exact answer. What are the default properties? how it will be overridden?
Upvotes: 5
Views: 27478
Reputation: 1808
You can configure the Hikari connection pool using the dedicated application properties provided by Spring Boot. You can find a complete list in the docs (search for "spring.datasource.hikari" in the page). The HikariConfig class from the HikariCP project is also a good place to check all the available configuration items and default values.
About how to size the connection pool, there's an interesting guide provided by the Hikari project itself.
Upvotes: 6
Reputation: 411
I found the default properties by enabling
logging.level.com.zaxxer.hikari=DEBUG
Following is the application.yml configuration:
spring.datasource:
url: "jdbc:mysql://<server>:<port>/<db>"
username: "myusername"
password: "mypwd"
hikari:
pool-name: "MyAppDataSourcePool"
Found following default properties: (You can override this but if you set the lower values or set other properties, would be ignored)
allowPoolSuspension.............false
autoCommit......................true
catalog.........................none
connectionInitSql...............none
connectionTestQuery.............none
connectionTimeout...............30000
dataSource......................none
dataSourceClassName.............none
dataSourceJNDI..................none
dataSourceProperties............{password=<masked>}
driverClassName................."com.mysql.cj.jdbc.Driver"
exceptionOverrideClassName......none
healthCheckProperties...........{}
healthCheckRegistry.............none
idleTimeout.....................600000
initializationFailTimeout.......1
isolateInternalQueries..........false
jdbcUrl.........................jdbc:mysql://<server>:<port>/<db>
leakDetectionThreshold..........0
maxLifetime.....................1800000
maximumPoolSize.................10
metricRegistry..................none
metricsTrackerFactory...........none
minimumIdle.....................10
password........................<masked>
poolName........................"MyAppDataSourcePool"
readOnly........................false
registerMbeans..................false
scheduledExecutor...............none
schema..........................none
threadFactory...................internal
transactionIsolation............default
username........................"myusername"
validationTimeout...............5000
Upvotes: 18