public class SimpleReactiveMongoDatabaseFactory extends Object implements org.springframework.beans.factory.DisposableBean, ReactiveMongoDatabaseFactory
MongoDatabase instances from a MongoClient instance.| Constructor and Description |
|---|
SimpleReactiveMongoDatabaseFactory(com.mongodb.ConnectionString connectionString)
Creates a new
SimpleReactiveMongoDatabaseFactory instance from the given ConnectionString. |
SimpleReactiveMongoDatabaseFactory(com.mongodb.reactivestreams.client.MongoClient mongoClient,
String databaseName)
Creates a new
SimpleReactiveMongoDatabaseFactory instance from the given MongoClient. |
| Modifier and Type | Method and Description |
|---|---|
void |
destroy()
Clean up the Mongo instance if it was created by the factory itself.
|
org.springframework.dao.support.PersistenceExceptionTranslator |
getExceptionTranslator()
Exposes a shared
MongoExceptionTranslator. |
com.mongodb.reactivestreams.client.MongoDatabase |
getMongoDatabase()
Creates a default
MongoDatabase instance. |
com.mongodb.reactivestreams.client.MongoDatabase |
getMongoDatabase(String dbName)
Creates a
MongoDatabase instance to access the database with the given name. |
void |
setWriteConcern(com.mongodb.WriteConcern writeConcern)
Configures the
WriteConcern to be used on the MongoDatabase instance being created. |
public SimpleReactiveMongoDatabaseFactory(com.mongodb.ConnectionString connectionString)
throws UnknownHostException
SimpleReactiveMongoDatabaseFactory instance from the given ConnectionString.connectionString - must not be null.UnknownHostExceptionpublic SimpleReactiveMongoDatabaseFactory(com.mongodb.reactivestreams.client.MongoClient mongoClient,
String databaseName)
SimpleReactiveMongoDatabaseFactory instance from the given MongoClient.mongoClient - must not be null.databaseName - must not be null.public void setWriteConcern(com.mongodb.WriteConcern writeConcern)
WriteConcern to be used on the MongoDatabase instance being created.writeConcern - the writeConcern to setpublic com.mongodb.reactivestreams.client.MongoDatabase getMongoDatabase()
throws org.springframework.dao.DataAccessException
ReactiveMongoDatabaseFactoryMongoDatabase instance.getMongoDatabase in interface ReactiveMongoDatabaseFactoryorg.springframework.dao.DataAccessExceptionpublic com.mongodb.reactivestreams.client.MongoDatabase getMongoDatabase(String dbName) throws org.springframework.dao.DataAccessException
ReactiveMongoDatabaseFactoryMongoDatabase instance to access the database with the given name.getMongoDatabase in interface ReactiveMongoDatabaseFactorydbName - must not be null or empty.org.springframework.dao.DataAccessExceptionpublic void destroy()
throws Exception
destroy in interface org.springframework.beans.factory.DisposableBeanExceptionDisposableBean.destroy()public org.springframework.dao.support.PersistenceExceptionTranslator getExceptionTranslator()
ReactiveMongoDatabaseFactoryMongoExceptionTranslator.getExceptionTranslator in interface ReactiveMongoDatabaseFactoryCopyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.