Good morning ,
I created two connection pools with data source under the ConfigurationProperties annotation using spring boot then when creating hikari gives the name HikariPool-1 and HikariPool-2
What I want is to change these names
could you explain to me how to do it please?
Best regards
Comment From: nosan
The easiest way is to use
spring.datasource.hikari.pool-name=<your pool name here>
If you do create HikariDataSource manually then you can use the following method:
HikariDataSource dataSource = ...
dataSource.setPoolName(properties.getName());
Something like this should work
@Bean
@ConfigurationProperties(prefix = "spring.datasource.hikari1")
HikariDataSource hikari1DataSource(DataSourceProperties properties) {
HikariDataSource dataSource = createDataSource(...);
return dataSource;
}
@Bean
@ConfigurationProperties(prefix = "spring.datasource.hikari2")
HikariDataSource hikari2DataSource(DataSourceProperties properties) {
HikariDataSource dataSource = createDataSource(...);
return dataSource;
}
spring.datasource.hikari1.pool-name=<your pool name here>
spring.datasource.hikari2.pool-name=<your pool name here>
Comment From: wilkinsona
Thanks, @nosan.
@mehdux For future reference, please note that we prefer not to use the issue tracker for questions such as this. Stack Overflow is a better place to get this sort of support from the community.