Class MongoClientSettingsFactoryBean

java.lang.Object
org.springframework.beans.factory.config.AbstractFactoryBean<com.mongodb.MongoClientSettings>
org.springframework.data.mongodb.core.MongoClientSettingsFactoryBean
All Implemented Interfaces:
Aware, BeanClassLoaderAware, BeanFactoryAware, DisposableBean, FactoryBean<com.mongodb.MongoClientSettings>, InitializingBean

public class MongoClientSettingsFactoryBean extends AbstractFactoryBean<com.mongodb.MongoClientSettings>
A factory bean for construction of a MongoClientSettings instance to be used with a MongoDB driver.
Since:
3.0
Author:
Christoph Strobl, Mark Paluch
  • Constructor Details

    • MongoClientSettingsFactoryBean

      public MongoClientSettingsFactoryBean()
  • Method Details

    • setSocketConnectTimeoutMS

      public void setSocketConnectTimeoutMS(int socketConnectTimeoutMS)
      Parameters:
      socketConnectTimeoutMS - in msec
      See Also:
      • SocketSettings.Builder.connectTimeout(int, TimeUnit)
    • setSocketReadTimeoutMS

      public void setSocketReadTimeoutMS(int socketReadTimeoutMS)
      Parameters:
      socketReadTimeoutMS - in msec
      See Also:
      • SocketSettings.Builder.readTimeout(int, TimeUnit)
    • setSocketReceiveBufferSize

      public void setSocketReceiveBufferSize(int socketReceiveBufferSize)
      Parameters:
      socketReceiveBufferSize -
      See Also:
      • SocketSettings.Builder.receiveBufferSize(int)
    • setSocketSendBufferSize

      public void setSocketSendBufferSize(int socketSendBufferSize)
      Parameters:
      socketSendBufferSize -
      See Also:
      • SocketSettings.Builder.sendBufferSize(int)
    • setServerHeartbeatFrequencyMS

      public void setServerHeartbeatFrequencyMS(long serverHeartbeatFrequencyMS)
      Parameters:
      serverHeartbeatFrequencyMS - in msec
      See Also:
      • ServerSettings.Builder.heartbeatFrequency(long, TimeUnit)
    • setServerMinHeartbeatFrequencyMS

      public void setServerMinHeartbeatFrequencyMS(long serverMinHeartbeatFrequencyMS)
      Parameters:
      serverMinHeartbeatFrequencyMS - in msec
      See Also:
      • ServerSettings.Builder.minHeartbeatFrequency(long, TimeUnit)
    • setClusterSrvHost

      public void setClusterSrvHost(String clusterSrvHost)
      Parameters:
      clusterSrvHost -
      See Also:
      • ClusterSettings.Builder.srvHost(String)
    • setClusterHosts

      public void setClusterHosts(com.mongodb.ServerAddress[] clusterHosts)
      Parameters:
      clusterHosts -
      See Also:
      • ClusterSettings.Builder.hosts(List)
    • setClusterConnectionMode

      public void setClusterConnectionMode(com.mongodb.connection.ClusterConnectionMode clusterConnectionMode)
      ????
      Parameters:
      clusterConnectionMode -
      See Also:
      • ClusterSettings.Builder.mode(ClusterConnectionMode)
    • setCusterRequiredClusterType

      public void setCusterRequiredClusterType(com.mongodb.connection.ClusterType custerRequiredClusterType)
      Parameters:
      custerRequiredClusterType -
      See Also:
      • ClusterSettings.Builder.requiredClusterType(ClusterType)
    • setClusterRequiredReplicaSetName

      public void setClusterRequiredReplicaSetName(String clusterRequiredReplicaSetName)
      Parameters:
      clusterRequiredReplicaSetName -
      See Also:
      • ClusterSettings.Builder.requiredReplicaSetName(String)
    • setClusterLocalThresholdMS

      public void setClusterLocalThresholdMS(long clusterLocalThresholdMS)
      Parameters:
      clusterLocalThresholdMS - in msec
      See Also:
      • ClusterSettings.Builder.localThreshold(long, TimeUnit)
    • setClusterServerSelectionTimeoutMS

      public void setClusterServerSelectionTimeoutMS(long clusterServerSelectionTimeoutMS)
      Parameters:
      clusterServerSelectionTimeoutMS - in msec
      See Also:
      • ClusterSettings.Builder.serverSelectionTimeout(long, TimeUnit)
    • setPoolMaxSize

      public void setPoolMaxSize(int poolMaxSize)
      Parameters:
      poolMaxSize -
      See Also:
      • ConnectionPoolSettings.Builder.maxSize(int)
    • setPoolMinSize

      public void setPoolMinSize(int poolMinSize)
      Parameters:
      poolMinSize -
      See Also:
      • ConnectionPoolSettings.Builder.minSize(int)
    • setPoolMaxWaitTimeMS

      public void setPoolMaxWaitTimeMS(long poolMaxWaitTimeMS)
      Parameters:
      poolMaxWaitTimeMS - in mesec
      See Also:
      • ConnectionPoolSettings.Builder.maxWaitTime(long, TimeUnit)
    • setPoolMaxConnectionLifeTimeMS

      public void setPoolMaxConnectionLifeTimeMS(long poolMaxConnectionLifeTimeMS)
      Parameters:
      poolMaxConnectionLifeTimeMS - in msec
      See Also:
      • ConnectionPoolSettings.Builder.maxConnectionLifeTime(long, TimeUnit)
    • setPoolMaxConnectionIdleTimeMS

      public void setPoolMaxConnectionIdleTimeMS(long poolMaxConnectionIdleTimeMS)
      Parameters:
      poolMaxConnectionIdleTimeMS - in msec
      See Also:
      • ConnectionPoolSettings.Builder.maxConnectionIdleTime(long, TimeUnit)
    • setPoolMaintenanceInitialDelayMS

      public void setPoolMaintenanceInitialDelayMS(long poolMaintenanceInitialDelayMS)
      Parameters:
      poolMaintenanceInitialDelayMS - in msec
      See Also:
      • ConnectionPoolSettings.Builder.maintenanceInitialDelay(long, TimeUnit)
    • setPoolMaintenanceFrequencyMS

      public void setPoolMaintenanceFrequencyMS(long poolMaintenanceFrequencyMS)
      Parameters:
      poolMaintenanceFrequencyMS - in msec
      See Also:
      • ConnectionPoolSettings.Builder.maintenanceFrequency(long, TimeUnit)
    • setSslEnabled

      public void setSslEnabled(Boolean sslEnabled)
      Parameters:
      sslEnabled -
      See Also:
      • SslSettings.Builder.enabled(boolean)
    • setSslInvalidHostNameAllowed

      public void setSslInvalidHostNameAllowed(Boolean sslInvalidHostNameAllowed)
      Parameters:
      sslInvalidHostNameAllowed -
      See Also:
      • SslSettings.Builder.invalidHostNameAllowed(boolean)
    • setSslProvider

      public void setSslProvider(String sslProvider)
      Parameters:
      sslProvider -
      See Also:
    • setApplicationName

      public void setApplicationName(@Nullable String applicationName)
      Parameters:
      applicationName -
      See Also:
      • MongoClientSettings.Builder.applicationName(String)
    • setRetryReads

      public void setRetryReads(@Nullable Boolean retryReads)
      Parameters:
      retryReads -
      See Also:
      • MongoClientSettings.Builder.retryReads(boolean)
    • setReadConcern

      public void setReadConcern(com.mongodb.ReadConcern readConcern)
      Parameters:
      readConcern -
      See Also:
      • MongoClientSettings.Builder.readConcern(ReadConcern)
    • setWriteConcern

      public void setWriteConcern(com.mongodb.WriteConcern writeConcern)
      Parameters:
      writeConcern -
      See Also:
      • MongoClientSettings.Builder.writeConcern(WriteConcern)
    • setRetryWrites

      public void setRetryWrites(@Nullable Boolean retryWrites)
      Parameters:
      retryWrites -
      See Also:
      • MongoClientSettings.Builder.retryWrites(boolean)
    • setReadPreference

      public void setReadPreference(com.mongodb.ReadPreference readPreference)
      Parameters:
      readPreference -
      See Also:
      • MongoClientSettings.Builder.readPreference(ReadPreference)
    • setStreamFactoryFactory

      @Deprecated(since="4.3") public void setStreamFactoryFactory(Object streamFactoryFactory)
      Deprecated.
      since 4.3, will be removed in the MongoDB 5.0 driver in favor of com.mongodb.connection.TransportSettings.
      Parameters:
      streamFactoryFactory -
    • setTransportSettings

      public void setTransportSettings(@Nullable com.mongodb.connection.TransportSettings transportSettings)
    • setCodecRegistry

      public void setCodecRegistry(org.bson.codecs.configuration.CodecRegistry codecRegistry)
      Parameters:
      codecRegistry -
      See Also:
      • MongoClientSettings.Builder.codecRegistry(CodecRegistry)
    • setuUidRepresentation

      public void setuUidRepresentation(@Nullable org.bson.UuidRepresentation uUidRepresentation)
      Parameters:
      uUidRepresentation -
    • setAutoEncryptionSettings

      public void setAutoEncryptionSettings(@Nullable com.mongodb.AutoEncryptionSettings autoEncryptionSettings)
      Parameters:
      autoEncryptionSettings - can be null.
      See Also:
      • MongoClientSettings.Builder.autoEncryptionSettings(AutoEncryptionSettings)
    • setServerApi

      public void setServerApi(@Nullable com.mongodb.ServerApi serverApi)
      Parameters:
      serverApi - can be null.
      Since:
      3.3
      See Also:
      • MongoClientSettings.Builder.serverApi(ServerApi)
    • getObjectType

      public Class<?> getObjectType()
      Specified by:
      getObjectType in interface FactoryBean<com.mongodb.MongoClientSettings>
      Specified by:
      getObjectType in class AbstractFactoryBean<com.mongodb.MongoClientSettings>
    • createInstance

      protected com.mongodb.MongoClientSettings createInstance()
      Specified by:
      createInstance in class AbstractFactoryBean<com.mongodb.MongoClientSettings>