Added a constructor for HikariConfig that accepts a Properties object. M... #10
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
...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.)