Annotation Interface Option.RegistryService

Enclosing class:
Option

@Target(METHOD) @Retention(CLASS) public static @interface Option.RegistryService
Options annotated with this annotation will use service registry to discover instances to use. This annotation cannot be combined with Option.Configured - if you want providers configured from configuration, kindly use Option.Provider.

Behavior depends on the return type of the annotated method:

  • A single instance - if the instance is configured on the builder by hand, registry is not used
  • An Optional instance - ditto
  • A List of instances - instances configured on the builder are combined with instances discovered in the registry; there is a generated method that allows for disabling registry use for each service
Options annotated with this annotation will load the instances as the default value (before method builder()) returns, thus you have full control over the field, be it an Optional, single value, or a List.

To support usage of custom service registry, a builder(ServiceRegistry) method will be generated as well.