diff --git a/src/org/redkale/boot/Application.java b/src/org/redkale/boot/Application.java index d613eb16d..3b49249cd 100644 --- a/src/org/redkale/boot/Application.java +++ b/src/org/redkale/boot/Application.java @@ -270,11 +270,6 @@ public final class Application { lib = lib.isEmpty() ? (homepath + "/conf") : (lib + ";" + homepath + "/conf"); Server.loadLib(logger, lib); initLogging(); - if (this.localAddress != null) { - byte[] bs = this.localAddress.getAddress(); - int v = (0xff & bs[bs.length - 2]) % 10 * 100 + (0xff & bs[bs.length - 1]); - this.factory.register("property.datasource.nodeid", "" + v); - } //------------------------------------------------------------------------ final AnyValue resources = config.getAnyValue("resources"); if (resources != null) { @@ -310,6 +305,11 @@ public final class Application { } } } + if (this.localAddress != null && this.factory.find("property.datasource.nodeid", String.class) == null) { + byte[] bs = this.localAddress.getAddress(); + int v = (0xff & bs[bs.length - 2]) % 10 * 100 + (0xff & bs[bs.length - 1]); + this.factory.register("property.datasource.nodeid", "" + v); + } this.factory.register(BsonFactory.root()); this.factory.register(JsonFactory.root()); this.factory.register(BsonFactory.root().getConvert());