diff --git a/gradle.properties.kts b/gradle.properties.kts index 12059f9..fa10939 100644 --- a/gradle.properties.kts +++ b/gradle.properties.kts @@ -1 +1 @@ -version = 0.2-SNAPSHOT \ No newline at end of file +version = 0.3-SNAPSHOT \ No newline at end of file diff --git a/src/main/java/com/knecon/fforesight/mongo/database/commons/config/MultiTenantMongoDBFactory.java b/src/main/java/com/knecon/fforesight/mongo/database/commons/config/MultiTenantMongoDBFactory.java index b113341..3390acc 100644 --- a/src/main/java/com/knecon/fforesight/mongo/database/commons/config/MultiTenantMongoDBFactory.java +++ b/src/main/java/com/knecon/fforesight/mongo/database/commons/config/MultiTenantMongoDBFactory.java @@ -26,7 +26,20 @@ public class MultiTenantMongoDBFactory extends SimpleMongoClientDatabaseFactory public MultiTenantMongoDBFactory(MongoDataSources mongoDataSources) { - super(new MongoClient() { + super(getBootstrapMongoClient(), "BOOTSTRAP"); + this.mongoDataSources = mongoDataSources; + } + + + @Override + protected @NotNull MongoDatabase doGetMongoDatabase(@NotNull String dbName) { + + return mongoDataSources.mongoDatabaseCurrentTenantResolver(); + } + + + private static MongoClient getBootstrapMongoClient() { + return new MongoClient() { @Override public MongoDatabase getDatabase(String s) { @@ -157,15 +170,7 @@ public class MultiTenantMongoDBFactory extends SimpleMongoClientDatabaseFactory return null; } - }, "BOOTSTRAP"); - this.mongoDataSources = mongoDataSources; - } - - - @Override - protected @NotNull MongoDatabase doGetMongoDatabase(@NotNull String dbName) { - - return mongoDataSources.mongoDatabaseCurrentTenantResolver(); + }; } }