diff --git a/core/src/main/java/com/zaxxer/hikari/HikariConfig.java b/core/src/main/java/com/zaxxer/hikari/HikariConfig.java index b5128d8e..4c4396bb 100644 --- a/core/src/main/java/com/zaxxer/hikari/HikariConfig.java +++ b/core/src/main/java/com/zaxxer/hikari/HikariConfig.java @@ -81,6 +81,18 @@ public final class HikariConfig implements HikariConfigMBean poolName = "HikariPool-" + poolNumber++; } + /** + * Construct a HikariConfig from the specified properties object. + * + * @param properties the name of the property file + */ + public HikariConfig(Properties properties) + { + this(); + PropertyBeanSetter.setTargetFromProperties(this, properties); + } + + /** * Construct a HikariConfig from the specified property file name. * @@ -96,9 +108,8 @@ public final class HikariConfig implements HikariConfigMBean throw new IllegalArgumentException("Property file " + propertyFileName + " was not found."); } - try + try ( FileInputStream fis = new FileInputStream(propFile) ) { - FileInputStream fis = new FileInputStream(propFile); Properties props = new Properties(); props.load(fis); PropertyBeanSetter.setTargetFromProperties(this, props);