xmldatabaseconnection-poolinghikaricpbonecp

Setting HikariCP configuration by passing an XML file


Am currently using BoneCP in my application and we add our configurations to 'https://github.com/wwadge/bonecp/blob/master/bonecp/src/main/resources/bonecp-default-config.xml' XML file. This was being done to take advantage of comments in the XML, which will help production support team when there is a need to change the configuration.

Now that am planning to switch to HikariCP, I do not see a way to set configurations in an XML file and send the same to HikariCPConfig. Is there really a way to set all configurations in XML file and pass to HikariCP?


Solution

  • HikariCP does not support loading from an XML file. However, it can load a Java properties file, which does permit comments (lines starting with # or ! characters).

    EDIT: In case I wasn't clear, the Properties class in Java contains a loadFromXML() method. Once properties are loaded, they can be passed into HikariCP for configuration.