Class NamedMongoConfiguration
java.lang.Object
io.micronaut.configuration.mongo.core.AbstractMongoConfiguration
io.micronaut.configuration.mongo.core.NamedMongoConfiguration
@EachProperty(value="mongodb.servers",
primary="default")
public class NamedMongoConfiguration
extends AbstractMongoConfiguration
Creates a named configuration for each entry under
MongoSettings.MONGODB_SERVERS
.- Since:
- 1.0
- Author:
- graemerocher
-
Field Summary
Modifier and TypeFieldDescriptionprotected com.mongodb.MongoClientSettings.Builder
protected com.mongodb.connection.ClusterSettings.Builder
protected com.mongodb.connection.ConnectionPoolSettings.Builder
protected com.mongodb.connection.ServerSettings.Builder
protected com.mongodb.connection.SocketSettings.Builder
protected com.mongodb.connection.SslSettings.Builder
-
Constructor Summary
ConstructorDescriptionNamedMongoConfiguration
(String serverName, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) Constructor.NamedMongoConfiguration
(String serverName, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.context.env.Environment environment) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
codecRegistries
(List<org.bson.codecs.configuration.CodecRegistry> codecRegistries) Additional codecs to register.void
Additional codecs to register.void
commandListeners
(List<com.mongodb.event.CommandListener> commandListeners) Additional command listeners to register.void
connectionPoolListeners
(List<com.mongodb.event.ConnectionPoolListener> connectionPoolListeners) Additional command listeners to register.protected String
Return the appplication name or a default name.com.mongodb.MongoClientSettings.Builder
com.mongodb.connection.ClusterSettings.Builder
com.mongodb.connection.ConnectionPoolSettings.Builder
com.mongodb.connection.ServerSettings.Builder
com.mongodb.connection.SocketSettings.Builder
com.mongodb.connection.SslSettings.Builder
void
setCodecRegistryBuilder
(CodecRegistryBuilder codecRegistryBuilder) Methods inherited from class io.micronaut.configuration.mongo.core.AbstractMongoConfiguration
addDefaultCodecRegistry, buildSettings, getCodecRegistries, getCodecs, getCommandListeners, getConnectionPoolListeners, getConnectionString, getPackageNames, getUri, isAutomaticClassModels, isUseSerde, packages, setAutomaticClassModels, setPackageNames, setUri, setUseSerde
-
Field Details
-
clientSettings
@ConfigurationBuilder(prefixes="") protected com.mongodb.MongoClientSettings.Builder clientSettings -
clusterSettings
@ConfigurationBuilder(prefixes="", configurationPrefix="cluster") protected com.mongodb.connection.ClusterSettings.Builder clusterSettings -
serverSettings
@ConfigurationBuilder(prefixes="", configurationPrefix="server") protected com.mongodb.connection.ServerSettings.Builder serverSettings -
poolSettings
@ConfigurationBuilder(prefixes="", configurationPrefix="connection-pool") protected com.mongodb.connection.ConnectionPoolSettings.Builder poolSettings -
socketSettings
@ConfigurationBuilder(prefixes="", configurationPrefix="socket") protected com.mongodb.connection.SocketSettings.Builder socketSettings -
sslSettings
@ConfigurationBuilder(prefixes="", configurationPrefix="ssl") protected com.mongodb.connection.SslSettings.Builder sslSettings
-
-
Constructor Details
-
NamedMongoConfiguration
public NamedMongoConfiguration(@Parameter String serverName, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration) Constructor.- Parameters:
serverName
- serverName from propertiesapplicationConfiguration
- applicationConfiguration
-
NamedMongoConfiguration
@Inject public NamedMongoConfiguration(@Parameter String serverName, io.micronaut.runtime.ApplicationConfiguration applicationConfiguration, io.micronaut.context.env.Environment environment) Constructor.- Parameters:
serverName
- serverName from propertiesapplicationConfiguration
- applicationConfigurationenvironment
- The environment
-
-
Method Details
-
codecs
Description copied from class:AbstractMongoConfiguration
Additional codecs to register.- Overrides:
codecs
in classAbstractMongoConfiguration
- Parameters:
codecList
- The list of codecs
-
codecRegistries
@Inject public void codecRegistries(List<org.bson.codecs.configuration.CodecRegistry> codecRegistries) Description copied from class:AbstractMongoConfiguration
Additional codecs to register.- Overrides:
codecRegistries
in classAbstractMongoConfiguration
- Parameters:
codecRegistries
- The list of codecs
-
setCodecRegistryBuilder
- Overrides:
setCodecRegistryBuilder
in classAbstractMongoConfiguration
- Parameters:
codecRegistryBuilder
- The builder
-
commandListeners
Description copied from class:AbstractMongoConfiguration
Additional command listeners to register.- Overrides:
commandListeners
in classAbstractMongoConfiguration
- Parameters:
commandListeners
- The list of command listeners
-
connectionPoolListeners
@Inject public void connectionPoolListeners(List<com.mongodb.event.ConnectionPoolListener> connectionPoolListeners) Description copied from class:AbstractMongoConfiguration
Additional command listeners to register.- Overrides:
connectionPoolListeners
in classAbstractMongoConfiguration
- Parameters:
connectionPoolListeners
- The list of command listeners
-
getServerName
- Returns:
- The name of the server
-
getClusterSettings
public com.mongodb.connection.ClusterSettings.Builder getClusterSettings()- Specified by:
getClusterSettings
in classAbstractMongoConfiguration
- Returns:
- The
ClusterSettings.builder()
-
getClientSettings
public com.mongodb.MongoClientSettings.Builder getClientSettings()- Specified by:
getClientSettings
in classAbstractMongoConfiguration
- Returns:
- The
MongoClientSettings.builder()
-
getServerSettings
public com.mongodb.connection.ServerSettings.Builder getServerSettings()- Specified by:
getServerSettings
in classAbstractMongoConfiguration
- Returns:
- The
ServerSettings.builder()
-
getPoolSettings
public com.mongodb.connection.ConnectionPoolSettings.Builder getPoolSettings()- Specified by:
getPoolSettings
in classAbstractMongoConfiguration
- Returns:
- The
ConnectionPoolSettings.builder()
-
getSocketSettings
public com.mongodb.connection.SocketSettings.Builder getSocketSettings()- Specified by:
getSocketSettings
in classAbstractMongoConfiguration
- Returns:
- The
SocketSettings.builder()
-
getSslSettings
public com.mongodb.connection.SslSettings.Builder getSslSettings()- Specified by:
getSslSettings
in classAbstractMongoConfiguration
- Returns:
- The
SslSettings.builder()
-
getApplicationName
Description copied from class:AbstractMongoConfiguration
Return the appplication name or a default name.- Overrides:
getApplicationName
in classAbstractMongoConfiguration
- Returns:
- applicationName
-