Class MongoClientFactory

  • All Implemented Interfaces:

    public class MongoClientFactory
    extends 
    implements 
    An ObjectFactory for MongoClient instances.
    Since:
    3.3
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
       obj,  name,  nameCtx, <?,​?> environment)
      This implementation will create instances of MongoClient based on a connection string conforming to the format specified in MongoClientURI.
      • Methods inherited from class java.lang.

        , , , , , , , , , ,
    • Constructor Detail

      • MongoClientFactory

        public MongoClientFactory()
    • Method Detail

      • getObjectInstance

        public  getObjectInstance​( obj,
                                         name,
                                         nameCtx,
                                        <?,​?> environment)
                                 throws 
        This implementation will create instances of MongoClient based on a connection string conforming to the format specified in MongoClientURI.

        The connection string is specified in one of two ways:

        • As the String value of a property in the environment parameter with a key of "connectionString"
        • As the String value of a with type "connectionString" in an obj parameter of type
        Specification of the connection string in the environment parameter takes precedence over specification in the obj parameter. The name and nameCtx parameters are ignored. If a non-empty connection string is not specified in either of these two ways, a MongoException is thrown.
        Specified by:
         in interface 
        Returns:
        an instance of MongoClient based on the specified connection string
        Throws:
        MongoException - Note: Not all options that can be specified via MongoClientOptions can be specified via the connection string.