Skip to content

Commit

Permalink
Added a constructor for HikariConfig that accepts a Properties object…
Browse files Browse the repository at this point in the history
…. Modified props-file reading constructor to use try-with-resources to ensure prompt file close.
  • Loading branch information
swaldman committed Dec 13, 2013
1 parent 78ffed0 commit 6c84ea8
Showing 1 changed file with 13 additions and 2 deletions.
15 changes: 13 additions & 2 deletions core/src/main/java/com/zaxxer/hikari/HikariConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,18 @@ public HikariConfig()
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.
*
Expand All @@ -96,9 +108,8 @@ public HikariConfig(String propertyFileName)
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);
Expand Down

0 comments on commit 6c84ea8

Please sign in to comment.