diff --git a/src/org/redkale/boot/NodeServer.java b/src/org/redkale/boot/NodeServer.java index f027ed398..b6f649264 100644 --- a/src/org/redkale/boot/NodeServer.java +++ b/src/org/redkale/boot/NodeServer.java @@ -242,13 +242,7 @@ public abstract class NodeServer { if (sourceConf != null) { final Class sourceType = resEntry.getKey(); if (sourceType == DataJdbcSource.class) { - Properties prop = new Properties(); - for (AnyValue itemConf : sourceConf.getAnyValues("property")) { - String name = itemConf.getValue("name"); - String value = itemConf.getValue("value"); - if (name != null && value != null) prop.put(name, value); - } - source = DataSources.createDataSource(resourceName, prop); + source = DataSources.createDataSource(resourceName, sourceConf); } else { boolean can = false; for (Constructor cr : sourceType.getConstructors()) { diff --git a/src/org/redkale/source/DataSources.java b/src/org/redkale/source/DataSources.java index c3e43653d..898c7f53f 100644 --- a/src/org/redkale/source/DataSources.java +++ b/src/org/redkale/source/DataSources.java @@ -10,6 +10,7 @@ import java.lang.reflect.Constructor; import java.net.URL; import java.util.*; import javax.xml.stream.*; +import org.redkale.util.AnyValue; /** * @@ -56,6 +57,19 @@ public final class DataSources { private DataSources() { } + public static DataSource createDataSource(final String unitName, final AnyValue conf) throws IOException { + Properties prop = new Properties(); + AnyValue[] confs = conf.getAnyValues("property"); + if (confs != null) { + for (AnyValue itemConf : confs) { + String name = itemConf.getValue("name"); + String value = itemConf.getValue("value"); + if (name != null && value != null) prop.put(name, value); + } + } + return createDataSource(unitName, prop, prop); + } + public static DataSource createDataSource(final String unitName, Properties prop) throws IOException { return createDataSource(unitName, prop, prop); }