public class MongoClientFactoryBean extends AbstractFactoryBean<com.mongodb.client.MongoClient> implements PersistenceExceptionTranslator
loggerOBJECT_TYPE_ATTRIBUTE| Constructor and Description |
|---|
MongoClientFactoryBean() |
| Modifier and Type | Method and Description |
|---|---|
protected com.mongodb.MongoClientSettings |
computeClientSetting()
Create
MongoClientSettings based on configuration and priority (lower is better). |
protected com.mongodb.client.MongoClient |
createInstance() |
protected void |
destroyInstance(com.mongodb.client.MongoClient instance) |
Class<? extends com.mongodb.client.MongoClient> |
getObjectType() |
void |
setConnectionString(com.mongodb.ConnectionString connectionString) |
void |
setCredential(com.mongodb.MongoCredential[] credential)
Set the list of credentials to be used when creating
MongoClient. |
void |
setExceptionTranslator(PersistenceExceptionTranslator exceptionTranslator)
Configures the
PersistenceExceptionTranslator to use. |
void |
setHost(String host)
Configures the host to connect to.
|
void |
setMongoClientSettings(com.mongodb.MongoClientSettings mongoClientOptions)
Set the
MongoClientSettings to be used when creating MongoClient. |
void |
setPort(int port)
Configures the port to connect to.
|
void |
setReplicaSet(String replicaSet) |
DataAccessException |
translateExceptionIfPossible(RuntimeException ex) |
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingletonpublic void setMongoClientSettings(@Nullable com.mongodb.MongoClientSettings mongoClientOptions)
MongoClientSettings to be used when creating MongoClient.mongoClientOptions - public void setCredential(@Nullable com.mongodb.MongoCredential[] credential)
MongoClient.credential - can be null.public void setHost(@Nullable String host)
host - public void setPort(int port)
port - public void setConnectionString(@Nullable com.mongodb.ConnectionString connectionString)
public void setExceptionTranslator(@Nullable PersistenceExceptionTranslator exceptionTranslator)
PersistenceExceptionTranslator to use.exceptionTranslator - public Class<? extends com.mongodb.client.MongoClient> getObjectType()
getObjectType in interface FactoryBean<com.mongodb.client.MongoClient>getObjectType in class AbstractFactoryBean<com.mongodb.client.MongoClient>@Nullable public DataAccessException translateExceptionIfPossible(RuntimeException ex)
translateExceptionIfPossible in interface PersistenceExceptionTranslatorprotected com.mongodb.client.MongoClient createInstance()
throws Exception
createInstance in class AbstractFactoryBean<com.mongodb.client.MongoClient>Exceptionprotected com.mongodb.MongoClientSettings computeClientSetting()
MongoClientSettings based on configuration and priority (lower is better).
mongoClientSettingsconnectionStringMongoClientSettingsprotected void destroyInstance(@Nullable com.mongodb.client.MongoClient instance) throws Exception
destroyInstance in class AbstractFactoryBean<com.mongodb.client.MongoClient>ExceptionCopyright © 2011–2022 Pivotal Software, Inc.. All rights reserved.