Package org.craftercms.commons.mongo
Class MongoClientFromUriFactoryBean
- java.lang.Object
-
- org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
-
- org.craftercms.commons.mongo.MongoClientFromUriFactoryBean
-
- All Implemented Interfaces:
org.springframework.beans.factory.Aware
,org.springframework.beans.factory.BeanClassLoaderAware
,org.springframework.beans.factory.BeanFactoryAware
,org.springframework.beans.factory.DisposableBean
,org.springframework.beans.factory.FactoryBean<com.mongodb.MongoClient>
,org.springframework.beans.factory.InitializingBean
public class MongoClientFromUriFactoryBean extends org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
FactoryBean
that besides creating aMongoClient
from a Mongo URI, closes the client when it's destroyed.- Author:
- avasquez
- See Also:
- MongoClientURI
-
-
Constructor Summary
Constructors Constructor Description MongoClientFromUriFactoryBean()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.mongodb.MongoClient
createInstance()
protected void
destroyInstance(com.mongodb.MongoClient mongoClient)
Class<?>
getObjectType()
void
setUri(String uri)
-
-
-
Field Detail
-
uri
protected String uri
-
-
Method Detail
-
setUri
public void setUri(String uri)
-
getObjectType
public Class<?> getObjectType()
- Specified by:
getObjectType
in interfaceorg.springframework.beans.factory.FactoryBean<com.mongodb.MongoClient>
- Specified by:
getObjectType
in classorg.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
-
createInstance
protected com.mongodb.MongoClient createInstance() throws Exception
- Specified by:
createInstance
in classorg.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
- Throws:
Exception
-
-