Class AbstractMongoConfiguration
java.lang.Object
io.micronaut.configuration.mongo.core.AbstractMongoConfiguration
- Direct Known Subclasses:
DefaultMongoConfiguration,NamedMongoConfiguration
Abstract Mongo configuration type.
- Since:
- 1.0
- Author:
- graemerocher
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractMongoConfiguration(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddDefaultCodecRegistry(List<org.bson.codecs.configuration.CodecRegistry> codecRegistries) Adds the default codec registry.com.mongodb.MongoClientSettingsvoidcodecRegistries(List<org.bson.codecs.configuration.CodecRegistry> codecRegistries) Additional codecs to register.voidAdditional codecs to register.voidcommandListeners(List<com.mongodb.event.CommandListener> commandListeners) Additional command listeners to register.voidconnectionPoolListeners(List<com.mongodb.event.ConnectionPoolListener> connectionPoolListeners) Additional command listeners to register.protected StringReturn the appplication name or a default name.abstract com.mongodb.MongoClientSettings.Builderabstract com.mongodb.connection.ClusterSettings.BuilderList<org.bson.codecs.configuration.CodecRegistry>The configured codec registries.List<org.bson.codecs.Codec<?>>The configured codecs.List<com.mongodb.event.CommandListener>The configured command listeners.List<com.mongodb.event.ConnectionPoolListener>The configured connection pool listeners.Optional<com.mongodb.ConnectionString>abstract com.mongodb.connection.ConnectionPoolSettings.Builderabstract com.mongodb.connection.ServerSettings.Builderabstract com.mongodb.connection.SocketSettings.Builderabstract com.mongodb.connection.SslSettings.Builder@NotBlank StringgetUri()booleanbooleanvoidpackages(Collection<String> packageNames) Additional codecs to register.voidsetAutomaticClassModels(boolean automaticClassModels) Whether to allow automatic class models (defaults to true).voidsetCodecRegistryBuilder(CodecRegistryBuilder codecRegistryBuilder) voidsetPackageNames(Collection<String> packageNames) The package names to allow for POJOs.voidSets the MongoDB URI.voidsetUseSerde(boolean useSerde) Activates Micronaut Serialization instead of MongoDB POJO.
-
Constructor Details
-
AbstractMongoConfiguration
protected AbstractMongoConfiguration(io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) Constructor.- Parameters:
applicationConfiguration- applicationConfiguration
-
-
Method Details
-
codecs
Additional codecs to register.- Parameters:
codecList- The list of codecs
-
codecRegistries
Additional codecs to register.- Parameters:
codecRegistries- The list of codecs
-
commandListeners
Additional command listeners to register.- Parameters:
commandListeners- The list of command listeners
-
connectionPoolListeners
public void connectionPoolListeners(List<com.mongodb.event.ConnectionPoolListener> connectionPoolListeners) Additional command listeners to register.- Parameters:
connectionPoolListeners- The list of command listeners
-
packages
Additional codecs to register.- Parameters:
packageNames- The package names
-
getCodecs
The configured codecs.- Returns:
- The codecs
-
getCodecRegistries
The configured codec registries.- Returns:
- The registries
-
getCommandListeners
The configured command listeners.- Returns:
- The command listeners
-
getConnectionPoolListeners
The configured connection pool listeners.- Returns:
- The connection pool listeners
-
getUri
- Returns:
- The MongoDB URI
-
setUri
Sets the MongoDB URI.- Parameters:
uri- The MongoDB URI
-
setPackageNames
The package names to allow for POJOs.- Parameters:
packageNames- The package names
-
getPackageNames
- Returns:
- The package names to allow for POJOs.
-
setAutomaticClassModels
public void setAutomaticClassModels(boolean automaticClassModels) Whether to allow automatic class models (defaults to true).- Parameters:
automaticClassModels- True if automatic class models should be allowed
-
isAutomaticClassModels
public boolean isAutomaticClassModels()- Returns:
- Whether to allow automatic class models (defaults to true).
-
getConnectionString
- Returns:
- The MongoDB
ConnectionString
-
getClusterSettings
public abstract com.mongodb.connection.ClusterSettings.Builder getClusterSettings()- Returns:
- The
ClusterSettings.builder()
-
getClientSettings
public abstract com.mongodb.MongoClientSettings.Builder getClientSettings()- Returns:
- The
MongoClientSettings.builder()
-
getServerSettings
public abstract com.mongodb.connection.ServerSettings.Builder getServerSettings()- Returns:
- The
ServerSettings.builder()
-
getPoolSettings
public abstract com.mongodb.connection.ConnectionPoolSettings.Builder getPoolSettings()- Returns:
- The
ConnectionPoolSettings.builder()
-
getSocketSettings
public abstract com.mongodb.connection.SocketSettings.Builder getSocketSettings()- Returns:
- The
SocketSettings.builder()
-
getSslSettings
public abstract com.mongodb.connection.SslSettings.Builder getSslSettings()- Returns:
- The
SslSettings.builder()
-
buildSettings
public com.mongodb.MongoClientSettings buildSettings()- Returns:
- Builds the
MongoClientSettings
-
addDefaultCodecRegistry
protected void addDefaultCodecRegistry(List<org.bson.codecs.configuration.CodecRegistry> codecRegistries) Adds the default codec registry.- Parameters:
codecRegistries- The codec registries
-
setCodecRegistryBuilder
- Parameters:
codecRegistryBuilder- The builder
-
getApplicationName
Return the appplication name or a default name.- Returns:
- applicationName
-
isUseSerde
public boolean isUseSerde()- Returns:
- useSerde
-
setUseSerde
public void setUseSerde(boolean useSerde) Activates Micronaut Serialization instead of MongoDB POJO.- Parameters:
useSerde- true if to activate
-