spring boot shardingsphere 使用hikari连接池配置
shardingsphere 使用hikari连接池配置:
shardingsphere:
datasource:
names: ds
ds:
type: com.zaxxer.hikari.HikariDataSource
driver-class-name: com.mysql.cj.jdbc.Driver
jdbc-url: jdbc:mysql://xxx.xxx.xxx.xxx:3306/databse?useSSL=false&useUnicode=true&characterEncoding=utf-8&autoReconnect=true&rewriteBatchedStatements=true&allowMultiQueries=true&serverTimezone=Asia/Shanghai
username: username
password: password
idle-timeout: 60000
connection-timeout: 30000
validation-timeout: 3000
max-lifetime: 58880
minimum-idle: 10
maximum-pool-size: 50
在常规的spring boot连接池配置中,池的配置信息会新增一级,例如 hikari
hikari:
idle-timeout: 60000
connection-timeout: 30000
validation-timeout: 3000
max-lifetime: 58880
maximum-pool-size: 50
shardingsphere 在获取连接池信息时,只获取了ds下一级目录下的配置作为连接池的配置信息。源码如下: