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>FactoryBeanthat besides creating aMongoClientfrom 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.MongoClientcreateInstance()protected voiddestroyInstance(com.mongodb.MongoClient mongoClient)Class<?>getObjectType()voidsetUri(String uri)
-
-
-
Field Detail
-
uri
protected String uri
-
-
Method Detail
-
setUri
public void setUri(String uri)
-
getObjectType
public Class<?> getObjectType()
- Specified by:
getObjectTypein interfaceorg.springframework.beans.factory.FactoryBean<com.mongodb.MongoClient>- Specified by:
getObjectTypein classorg.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
-
createInstance
protected com.mongodb.MongoClient createInstance() throws Exception- Specified by:
createInstancein classorg.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>- Throws:
Exception
-
-