@java.lang.FunctionalInterface interface MongoClientSettingsBuilderCustomizer
Callback interface that can be implemented by beans wishing to customize the MongoClientSettings.Builder used to construct the underlying com.mongodb.client.MongoClient before it is created.
Any beans of this type found in the application context are applied, in order,
to the builder for the default connection source. This is the supported extension
point for settings that cannot be expressed through grails.mongodb.*
configuration — for example registering a driver
com.mongodb.event.CommandListener for metrics/tracing, tuning the connection
pool, or configuring read/write concerns programmatically.
@Bean
MongoClientSettingsBuilderCustomizer mongoMetrics(MeterRegistry registry) {
return { builder -> builder.addCommandListener(new MongoMetricsCommandListener(registry)) }
}
Mirrors the semantics of Spring Boot's
MongoClientSettingsBuilderCustomizer.
Customize the MongoClientSettings.Builder.
builder - the builder to customize, never null