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 a MongoClient
from a Mongo URI,
closes the client when it's destroyed.- Author:
- avasquez
- See Also:
-
Field Summary
Fields inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
logger
Fields inherited from interface org.springframework.beans.factory.FactoryBean
OBJECT_TYPE_ATTRIBUTE
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected com.mongodb.MongoClient
protected void
destroyInstance
(com.mongodb.MongoClient mongoClient) Class<?>
void
Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean
afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton
-
Field Details
-
uri
-
-
Constructor Details
-
MongoClientFromUriFactoryBean
public MongoClientFromUriFactoryBean()
-
-
Method Details
-
setUri
-
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
- Specified by:
createInstance
in classorg.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
- Throws:
Exception
-
destroyInstance
- Overrides:
destroyInstance
in classorg.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
- Throws:
Exception
-