brettwooldridge/HikariCP — pull request #10 by swaldman (2013-12-13 11:42:37+00:00)
Title: Added a constructor for HikariConfig that accepts a Properties object. M...

...odified props-file reading constructor to use try-with-resources to ensure prompt file close.

The motivation here is integration with app servers and other projects that might wish to integrate HikariCP and allow configuration from their native config files. Such projects could read properties one by one and call set methods directly on the HikariConfig object, but that's fragile: if HikariCP ever adds new config, these projects will have to be updated to support them. With a constructor that accepts a Properties object, other projects can read their own native config, extract HikariCP-related properties based on a section or prefix, and construct their DataSource from whatever is found without worrying about HikariCP-specific config details.

(Also, the Properties-file based constructor opens but does not close a file descriptor; since HikariCP is a Java7+ project, try-with-resources is a quick way to ensure reliable resource cleanup.)