org.springframework.data.mongodb.core
Class MongoFactoryBean
java.lang.Object
org.springframework.data.mongodb.core.MongoFactoryBean
- All Implemented Interfaces:
- DisposableBean, FactoryBean<Mongo>, InitializingBean, PersistenceExceptionTranslator
public class MongoFactoryBean
- extends Object
- implements FactoryBean<Mongo>, InitializingBean, DisposableBean, PersistenceExceptionTranslator
Convenient factory for configuring MongoDB.
- Since:
- 1.0
- Author:
- Thomas Risberg, Graeme Rocher, Oliver Gierke
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
MongoFactoryBean
public MongoFactoryBean()
setMongoOptions
public void setMongoOptions(MongoOptions mongoOptions)
setReplicaSetSeeds
public void setReplicaSetSeeds(ServerAddress[] replicaSetSeeds)
setReplicaPair
public void setReplicaPair(ServerAddress[] replicaPair)
setHost
public void setHost(String host)
setPort
public void setPort(int port)
setWriteConcern
public void setWriteConcern(WriteConcern writeConcern)
- Sets the
WriteConcern
to be configured for the Mongo
instance to be created.
- Parameters:
writeConcern
-
setExceptionTranslator
public void setExceptionTranslator(PersistenceExceptionTranslator exceptionTranslator)
getObject
public Mongo getObject()
throws Exception
- Specified by:
getObject
in interface FactoryBean<Mongo>
- Throws:
Exception
getObjectType
public Class<? extends Mongo> getObjectType()
- Specified by:
getObjectType
in interface FactoryBean<Mongo>
isSingleton
public boolean isSingleton()
- Specified by:
isSingleton
in interface FactoryBean<Mongo>
translateExceptionIfPossible
public DataAccessException translateExceptionIfPossible(RuntimeException ex)
- Specified by:
translateExceptionIfPossible
in interface PersistenceExceptionTranslator
afterPropertiesSet
public void afterPropertiesSet()
throws Exception
- Specified by:
afterPropertiesSet
in interface InitializingBean
- Throws:
Exception
destroy
public void destroy()
throws Exception
- Specified by:
destroy
in interface DisposableBean
- Throws:
Exception
Copyright © 2012. All Rights Reserved.