Skip to content

Commit

Permalink
fix(dynamic-datasource-creator):解决当存在publicKey时,druid数据源创建异常问题 (#605)
Browse files Browse the repository at this point in the history
Co-authored-by: jiangxinjun <[email protected]>
  • Loading branch information
qq592304796 and jiangxinjun authored Jan 2, 2024
1 parent 0218196 commit 2190df2
Showing 1 changed file with 9 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.lang.reflect.Method;
import java.util.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Properties;
import java.util.Set;

/**
* Druid配置工具类
Expand Down Expand Up @@ -85,7 +91,8 @@ public static Properties toProperties(@NonNull DruidConfig config) {
}
properties.setProperty(FILTERS, filters);

Properties connectProperties = config.getConnectionProperties();
Properties connectProperties = Optional.ofNullable(config.getConnectionProperties())
.orElse(new Properties());
if (configFilterExist) {
connectProperties.setProperty("config.decrypt", Boolean.TRUE.toString());
connectProperties.setProperty("config.decrypt.key", publicKey);
Expand Down

0 comments on commit 2190df2

Please sign in to comment.