Interface MongoClientCustomizer


  • public interface MongoClientCustomizer
    Interface implemented by CDI beans that want to customize the Mongo client configuration. This is useful for example to configure client-side field encryption.

    The implementing bean should use the MongoClientName qualifier to be used for a specific client. A bean implementing this interface without the qualifier will be used for the default client only.

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      com.mongodb.MongoClientSettings.Builder customize​(com.mongodb.MongoClientSettings.Builder builder)
      Customizes the Mongo client configuration.
    • Method Detail

      • customize

        com.mongodb.MongoClientSettings.Builder customize​(com.mongodb.MongoClientSettings.Builder builder)
        Customizes the Mongo client configuration.

        This method is called during the creation of the MongoClient instance. The Quarkus configuration had already been processed. It gives you the opportunity to extend that configuration or override the processed configuration.

        Implementation can decide to ignore the passed builder to build their own. However, this should be used with caution as it can lead to unexpected results such as not having the right Mongo connection string.

        Parameters:
        builder - the builder to customize the MongoClient instance
        Returns:
        the builder to use to create the MongoClient instance