-
Notifications
You must be signed in to change notification settings - Fork 41.5k
Description
Please add support / auto-configuration for Vibur DBCP connection pool (https://github.com/vibur/vibur-dbcp) in spring-boot.
Vibur DBCP is a concurrent, fast, and fully-featured JDBC connection pool, which has been around since 2013. The pool provides advanced performance monitoring capabilities, including slow SQL queries detection and logging, a non-starvation guarantee for application threads, statement caching, among other features.
Currently, spring-boot has built-in support for auto-configuration of the following jdbc connection pools in this order:
- DataSourceConfiguration.Hikari.class,
- DataSourceConfiguration.Tomcat.class
- DataSourceConfiguration.Dbcp2.class
- DataSourceConfiguration.OracleUcp.class
This issue is, in fact, to add Vibur DBCP to the above list. The Vibur DataSource class that needs to be instantiated is org.vibur.dbcp.ViburDBCPDataSource.class
.
To the best of my understanding, adding support for Vibur will involve as a minimum changes in the DataSourceAutoConfiguration
and DataSourceConfiguration
classes from spring-boot-autoconfigure
, and in the DataSourceBuilder
class from spring-boot
.
Note that Vibur requires its start()
method to be called once the pool is configured. This method will validate the pool configuration. The pool also implements a close()
method as part of its implementation of AutoClosebale
.
If Vibur connection pool had to be instantiated from Java programming code, without the help of the spring.datasource.url
, spring.datasource.username
, spring.datasource.password
, spring.datasource.driver-class-name
properties, this could be done via something like:
@Bean(initMethod = "start", destroyMethod = "close")
@ConfigurationProperties(prefix = "spring.datasource.vibur")
public DataSource dataSource() {
return new ViburDBCPDataSource();
}
The above snippet assumes that all Vibur config properties have a prefix of spring.datasource.vibur
.
The disadvantage of such instantiation is that Vibur cannot utilize the mentioned earlier and standard for spring-boot 4 config properties with a prefix of spring.datasource
. These 4 properties have to be repeated with a prefix of spring.datasource.vibur
, where the url
property needs be named jdbc-url
as this is the name of the internal Vibur jdbc url property.
Disclaimer, I'm the author of Vibur DBCP. I'm happy to help with any questions which you may have about Vibur DBCP configuration or setup.