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
    Modifier and Type
    Field
    Description
    protected String
     

    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

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected com.mongodb.MongoClient
     
    protected void
    destroyInstance(com.mongodb.MongoClient mongoClient)
     
     
    void
     

    Methods inherited from class org.springframework.beans.factory.config.AbstractFactoryBean

    afterPropertiesSet, destroy, getBeanFactory, getBeanTypeConverter, getEarlySingletonInterfaces, getObject, isSingleton, setBeanClassLoader, setBeanFactory, setSingleton

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • MongoClientFromUriFactoryBean

      public MongoClientFromUriFactoryBean()
  • Method Details

    • setUri

      public void setUri(String uri)
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface org.springframework.beans.factory.FactoryBean<com.mongodb.MongoClient>
      Specified by:
      getObjectType in class org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
    • createInstance

      protected com.mongodb.MongoClient createInstance() throws Exception
      Specified by:
      createInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
      Throws:
      Exception
    • destroyInstance

      protected void destroyInstance(com.mongodb.MongoClient mongoClient) throws Exception
      Overrides:
      destroyInstance in class org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClient>
      Throws:
      Exception