Module io.helidon.service.registry
Package io.helidon.service.registry
Annotation Interface Service.Provider
- Enclosing class:
Service
A service provider. This is similar to
ServiceLoader
service providers.
The provider is an implementation of a Service.Contract
that is discoverable by
the service registry.
A service provider annotated with this annotation must provide either of:
- an accessible no-argument constructor (package private is sufficient), and must itself be at least package private
- an accessible constructor with arguments that are all services as well
Contract
- obtain an instance of a service providing that contractOptional<Contract>
- the other service may not be availableList<Contract>
- obtain all instances of services providing the contractSupplier<Contract>
- and suppliers of all above, to break instantiation chaining, and to support cyclic service references, just make sure you call theget
method outside of the constructor
- Direct implementation of interface (or extending an abstract class)
- Implementing a
Supplier
of the contract; when using supplier, service registry supports the capability to returnOptional
in case the service cannot provide a value; such a service will be ignored and only other implementations (with lower weight) would be used. Supplier will be called each time the dependency is used, or each time a method on registry is called to request an instance
-
Field Summary
-
Field Details
-
TYPE
Type name of this annotation.
-