You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/SimpleMongoClientDatabaseFactory.java
+9-3Lines changed: 9 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -34,7 +34,8 @@ public class SimpleMongoClientDatabaseFactory extends MongoDatabaseFactorySuppor
34
34
implementsDisposableBean {
35
35
36
36
/**
37
-
* Creates a new {@link SimpleMongoClientDatabaseFactory} instance for the given {@code connectionString}.
37
+
* Creates a new {@link SimpleMongoClientDatabaseFactory} instance for the given {@code connectionString}. Using this
38
+
* constructor will create a new {@link MongoClient} instance that will be closed when calling {@link #destroy()}.
38
39
*
39
40
* @param connectionString connection coordinates for a database connection. Must contain a database name and must not
40
41
* be {@literal null} or empty.
@@ -45,7 +46,8 @@ public SimpleMongoClientDatabaseFactory(String connectionString) {
45
46
}
46
47
47
48
/**
48
-
* Creates a new {@link SimpleMongoClientDatabaseFactory} instance from the given {@link MongoClient}.
49
+
* Creates a new {@link SimpleMongoClientDatabaseFactory} instance from the given {@link MongoClient}. Using this
50
+
* constructor will create a new {@link MongoClient} instance that will be closed when calling {@link #destroy()}.
49
51
*
50
52
* @param connectionString connection coordinates for a database connection. Must contain also a database name and not
51
53
* be {@literal null}.
@@ -55,7 +57,10 @@ public SimpleMongoClientDatabaseFactory(ConnectionString connectionString) {
55
57
}
56
58
57
59
/**
58
-
* Creates a new {@link SimpleMongoClientDatabaseFactory} instance from the given {@link MongoClient}.
60
+
* Creates a new {@link SimpleMongoClientDatabaseFactory} instance from the given {@link MongoClient}. Note that the
61
+
* client will not be closed when calling {@link #destroy()} as we assume a managed client instance that we do not
62
+
* want to close on {@link #destroy()} meaning that you (or the application container) must dispose the client
63
+
* instance once it is no longer required for use.
59
64
*
60
65
* @param mongoClient must not be {@literal null}.
61
66
* @param databaseName must not be {@literal null} or empty.
Copy file name to clipboardExpand all lines: spring-data-mongodb/src/main/java/org/springframework/data/mongodb/core/SimpleReactiveMongoDatabaseFactory.java
0 commit comments