Skip to content

Make HikariConfig setters chainable #2318

Description

@richardfearn

It would be helpful if the setters in HikariConfig were chainable (i.e. returned this) so that several properties could be set without repeating the variable name. Instead of:

final HikariConfig config = new HikariConfig();
config.setMinimumIdle(...);
config.setMaximumPoolSize(...);
config.setMaxLifetime(...);
config.setDriverClassName(...);
config.setJdbcUrl(...);
config.setUsername(...);
config.setPassword(...);

we would be able to do:

final HikariConfig config = new HikariConfig()
    .setMinimumIdle(...)
    .setMaximumPoolSize(...)
    .setMaxLifetime(...)
    .setDriverClassName(...)
    .setJdbcUrl(...)
    .setUsername(...)
    .setPassword(...);

Alternatively if the signature of the existing setters cannot be changed, new methods could be added without the set prefix:

final HikariConfig config = new HikariConfig()
    .minimumIdle(...)
    .maximumPoolSize(...)
    .maxLifetime(...)
    .driverClassName(...)
    .jdbcUrl(...)
    .username(...)
    .password(...);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions