com.holonplatform.datastore.mongo.spring

## Annotation Type EnableMongoAsyncDatastore

-     @Target(value=TYPE)
       @Retention(value=RUNTIME)
       @Documented
       @Inherited
       @Import(value=com.holonplatform.datastore.mongo.spring.internal.MongoAsyncDatastoreRegistrar.class)
       @EnableDatastoreConfiguration
      public @interface EnableMongoAsyncDatastore

  Annotation to be used on Spring Configuration classes to setup an asynchronous MongoDB `AsyncDatastore`.
  Since:
    5.2.0

- - ### Field Summary

    Fields
    Modifier and Type | Fields and Description
    --- | ---
    `static String` | `DEFAULT_DATASTORE_BEAN_NAME` Default Datastore registration bean name.

  - ### Optional Element Summary

    Optional Elements
    Modifier and Type | Optional Element and Description
    --- | ---
    `String` | `database` Get the database name to use.
    `String` | `dataContextId` Optional data context id to use to discriminate Datastores when more than one persistence source is configured, i.e. when multiple `MongoClient` beans are configured in context.
    `EnumCodecStrategy` | `enumCodecStrategy` The default `EnumCodecStrategy` to use when encoding and decoding enum type values.
    `String` | `mongoClientReference` Configures the name of the `MongoClient` bean definition to be used to create the `Datastore` registered using this annotation.
    `com.holonplatform.spring.PrimaryMode` | `primary` Whether to qualify `Datastore` bean as `primary`, i.e. the preferential bean to be injected in a single-valued dependency when multiple candidates are present.
    `MongoReadConcern` | `readConcern` Get the default `ReadConcern` for the read operations isolation level.
    `MongoReadPreference` | `readPreference` Get the default `ReadPreference` for query or data read operations.
    `MongoWriteConcern` | `writeConcern` Get the default `WriteConcern` for write operations acknowledgment.

- - ### Field Detail

    - #### DEFAULT_DATASTORE_BEAN_NAME

          public static final String DEFAULT_DATASTORE_BEAN_NAME

      Default Datastore registration bean name.

  - ### Element Detail

    - #### dataContextId

          public abstract String dataContextId

      Optional data context id to use to discriminate Datastores when more than one persistence source is configured, i.e. when multiple `MongoClient` beans are configured in context.

      The configured data context id will be returned by the `DataContextBound.getDataContextId()` method of the registered `Datastore`.

      When a data context id is specified, the registered Datastore is bound to the `MongoClient` with a matching data context id, if available. During registration phase, if the data context id is not null/empty and a `mongoClientReference()` is not specified, a `MongoClient` bean is searched in context using the bean name pattern: `mongoClient_[datacontextid]` where `[datacontextid]` is equal to `dataContextId()` attribute.

      Returns:
        Data context id
      Default:
        ""

  - - #### mongoClientReference

          public abstract String mongoClientReference

      Configures the name of the `MongoClient` bean definition to be used to create the `Datastore` registered using this annotation. See `dataContextId()` for informations about `MongoClient` bean lookup when a specific name is not configured.

      By default, the `MongoDatastoreConfigProperties.DEFAULT_MONGO_CLIENT_BEAN_NAME` bean name is used.

      Returns:
        The name of the `MongoClient` bean definition to be used to create the `Datastore`
      Default:
        ""

  - - #### database

          public abstract String database

      Get the database name to use.
      Returns:
        the database name
      Default:
        ""

  - - #### primary

          public abstract com.holonplatform.spring.PrimaryMode primary

      Whether to qualify `Datastore` bean as `primary`, i.e. the preferential bean to be injected in a single-valued dependency when multiple candidates are present.

      When mode is `PrimaryMode.AUTO`, the registred Datastore bean is marked as primary only when the `MongoClient` bean to which is bound is registered as primary bean.

      Returns:
        Primary mode, defaults to `PrimaryMode.AUTO`
      Default:
        com.holonplatform.spring.PrimaryMode.AUTO

  - - #### readPreference

          public abstract MongoReadPreference readPreference

      Get the default `ReadPreference` for query or data read operations.
      Returns:
        The default `ReadPreference` using the `MongoReadPreference` enumeration
      Default:
        com.holonplatform.datastore.mongo.core.enumerations.MongoReadPreference.DEFAULT

  - - #### readConcern

          public abstract MongoReadConcern readConcern

      Get the default `ReadConcern` for the read operations isolation level.
      Returns:
        The default `ReadConcern` using the `MongoReadConcern` enumeration
      Default:
        com.holonplatform.datastore.mongo.core.enumerations.MongoReadConcern.DEFAULT

  - - #### writeConcern

          public abstract MongoWriteConcern writeConcern

      Get the default `WriteConcern` for write operations acknowledgment.
      Returns:
        The default `WriteConcern` using the `MongoWriteConcern` enumeration
      Default:
        com.holonplatform.datastore.mongo.core.enumerations.MongoWriteConcern.DEFAULT

  - - #### enumCodecStrategy

          public abstract EnumCodecStrategy enumCodecStrategy

      The default `EnumCodecStrategy` to use when encoding and decoding enum type values.
      Returns:
        The default `EnumCodecStrategy`, defaults to `EnumCodecStrategy.NAME`
      Default:
        com.holonplatform.datastore.mongo.core.document.EnumCodecStrategy.NAME

Copyright © 2019 The Holon Platform. All rights reserved.