Skip to content

Commit

Permalink
also convert Hikary config properties to String
Browse files Browse the repository at this point in the history
  • Loading branch information
gavinking committed Dec 21, 2024
1 parent 4180967 commit 287d08a
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class HikariConfigurationUtil {
* @return a HikariConfig
*/
public static HikariConfig loadConfiguration(Map<String,Object> props) {
Properties hikariProps = new Properties();
final Properties hikariProps = new Properties();
copyProperty( JdbcSettings.AUTOCOMMIT, props, "autoCommit", hikariProps );

copyProperty(
Expand Down Expand Up @@ -74,9 +74,10 @@ public static HikariConfig loadConfiguration(Map<String,Object> props) {

copyIsolationSetting( props, hikariProps );

for ( String key : props.keySet() ) {
for ( var entry : props.entrySet() ) {
final String key = entry.getKey();
if ( key.startsWith( CONFIG_PREFIX ) ) {
hikariProps.setProperty( key.substring( CONFIG_PREFIX.length() ), (String) props.get( key ) );
hikariProps.setProperty( key.substring( CONFIG_PREFIX.length() ), entry.getValue().toString() );
}
}

Expand All @@ -85,7 +86,7 @@ public static HikariConfig loadConfiguration(Map<String,Object> props) {

private static void copyProperty(String srcKey, Map<String,Object> src, String dstKey, Properties dst) {
if ( src.containsKey( srcKey ) ) {
dst.setProperty( dstKey, (String) src.get( srcKey ) );
dst.setProperty( dstKey, src.get( srcKey ).toString() );
}
}

Expand Down

0 comments on commit 287d08a

Please sign in to comment.