Annotation Interface Service.PerInstance

Enclosing class:
Service

@Documented @Retention(CLASS) @Target(TYPE) public static @interface Service.PerInstance
A service that has instances created for each named instance of the service it is driven by. The instance created will have the same Service.Named qualifier as the driving instance (in addition to all qualifiers defined on this service).

There are a few restrictions on this type of services:

  • The service MUST NOT implement Supplier
  • The service MUST NOT implement Service.InjectionPointFactory
  • The service MUST NOT implement Service.ServicesFactory
  • All types that inherit from this service will also inherit the driven by
  • There MAY be an injection point of the type defined in value(), without any qualifiers - this injection point will be satisfied by the driving instance
  • There MAY be a String injection point qualified with Service.InstanceName - this injection point will be satisfied by the name of the driving instance
  • Required Element Summary

    Required Elements
    Modifier and Type
    Required Element
    Description
    The service type driving this service.
  • Element Details

    • value

      Class<?> value
      The service type driving this service. If the service provides more than one instance, the instances MUST be Service.Named.
      Returns:
      type of the service driving instances of this service