public class MongoClientFactoryBean
extends org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.Mongo>
implements org.springframework.dao.support.PersistenceExceptionTranslator
Constructor and Description |
---|
MongoClientFactoryBean() |
Modifier and Type | Method and Description |
---|---|
protected com.mongodb.Mongo |
createInstance() |
protected void |
destroyInstance(com.mongodb.Mongo instance) |
Class<? extends com.mongodb.Mongo> |
getObjectType() |
void |
setCredentials(com.mongodb.MongoCredential[] credentials)
Set the list of credentials to be used when creating
MongoClient . |
void |
setExceptionTranslator(org.springframework.dao.support.PersistenceExceptionTranslator exceptionTranslator)
Configures the
PersistenceExceptionTranslator to use. |
void |
setHost(String host)
Configures the host to connect to.
|
void |
setMongoClientOptions(com.mongodb.MongoClientOptions mongoClientOptions)
Set the
MongoClientOptions to be used when creating MongoClient . |
void |
setPort(int port)
Configures the port to connect to.
|
void |
setReplicaSetSeeds(com.mongodb.ServerAddress[] replicaSetSeeds)
Set the list of
ServerAddress to build up a replica set for. |
org.springframework.dao.DataAccessException |
translateExceptionIfPossible(RuntimeException ex) |
public void setMongoClientOptions(com.mongodb.MongoClientOptions mongoClientOptions)
MongoClientOptions
to be used when creating MongoClient
.mongoClientOptions
- public void setCredentials(com.mongodb.MongoCredential[] credentials)
MongoClient
.credentials
- can be null.public void setReplicaSetSeeds(com.mongodb.ServerAddress[] replicaSetSeeds)
ServerAddress
to build up a replica set for.replicaSetSeeds
- can be null.public void setHost(String host)
host
- public void setPort(int port)
port
- public void setExceptionTranslator(org.springframework.dao.support.PersistenceExceptionTranslator exceptionTranslator)
PersistenceExceptionTranslator
to use.exceptionTranslator
- public Class<? extends com.mongodb.Mongo> getObjectType()
getObjectType
in interface org.springframework.beans.factory.FactoryBean<com.mongodb.Mongo>
getObjectType
in class org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.Mongo>
public org.springframework.dao.DataAccessException translateExceptionIfPossible(RuntimeException ex)
translateExceptionIfPossible
in interface org.springframework.dao.support.PersistenceExceptionTranslator
protected com.mongodb.Mongo createInstance() throws Exception
createInstance
in class org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.Mongo>
Exception
Copyright © 2011–2017 Pivotal Software, Inc.. All rights reserved.