brettwooldridge / HikariCP

光 HikariCP・A solid, high-performance, JDBC connection pool at last.
Apache License 2.0
19.63k stars 2.9k forks source link

Properties in configuration files: use dataSource prefix ? #2182

Open NathanEckert opened 4 months ago

NathanEckert commented 4 months ago

Hello,

On the example property file provided in https://github.com/brettwooldridge/HikariCP?tab=readme-ov-file#rocket-initialization

Most of the properties are prefixed with dataSource.. However, upon playing with the configuration, I noticed it is not true for all, for example:

  @Test
  void testHikariConfigFileWithDataSourcePrefix() {
    System.setProperty("hikaricp.configurationFile", "src/test/resources/hikari_with_prefix.properties");

    var config = new HikariConfig();

    config.setJdbcUrl(RedshiftTestConstants.REDSHIFT_JDBC_URL + RedshiftTestConstants.TEST_DATABASE_NAME);
    config.setUsername(System.getenv("REDSHIFT_USERNAME"));
    config.setPassword(System.getenv("REDSHIFT_PASSWORD"));

    @Cleanup
    var dataSource = new HikariDataSource(config);

    SoftAssertions softly = new SoftAssertions();
    softly.assertThat(dataSource.getConnectionTimeout()).isEqualTo(250);
    softly.assertThat(config.getConnectionTimeout()).isEqualTo(250);
    softly.assertAll();

  }

Associated with the file:

dataSource.connectionTimeout=250

If I change the file to

connectionTimeout=250

it works.

I was wondering where i could get the list of the actual names to use (mentioning also if it has a prefix). If this list exist, I could quickly update the README