Module io.helidon.service.registry
Package io.helidon.service.registry
Interface ServiceRegistryConfig
- All Superinterfaces:
Prototype.Api
- All Known Implementing Classes:
ServiceRegistryConfig.BuilderBase.ServiceRegistryConfigImpl
Helidon service registry configuration.
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic class
Fluent API builder forServiceRegistryConfig
.static class
ServiceRegistryConfig.BuilderBase<BUILDER extends ServiceRegistryConfig.BuilderBase<BUILDER,
PROTOTYPE>, PROTOTYPE extends ServiceRegistryConfig> Fluent API builder base forServiceRegistryConfig
. -
Method Summary
Modifier and TypeMethodDescriptionboolean
Whether to allow binding via methods, such asServices.set(Class, Object[])
.builder()
Create a new fluent API builder to customize configuration.builder
(ServiceRegistryConfig instance) Create a new fluent API builder from an existing instance.static ServiceRegistryConfig
create()
Create a new instance with default values.boolean
Whether to discover services from the class path.boolean
Whether to discover services from Java service loader.boolean
Flag indicating whether runtime interception is enabled.In certain conditions Injection services should be initialized but not started (i.e., avoiding calls toPostConstruct
etc.).boolean
Flag indicating whether service lookups (i.e., viaServiceRegistry.first(io.helidon.service.registry.Lookup)
) are cached.int
Size of the lookup cache whenServiceRegistryConfigBlueprint.lookupCacheEnabled()
is set totrue
.double
Maximal run level to handle when starting fromServiceRegistryManager.start(Binding)
.Run levels that should be initialized at startup.Manually registered service descriptors to add to the registry.Manually register initial bindings for some of the services in the registry.boolean
Flag indicating whether compile-time generatedBinding
's should be used at initialization when starting the registry usingServiceRegistryManager.start(Binding)
.
-
Method Details
-
builder
Create a new fluent API builder to customize configuration.- Returns:
- a new builder
-
builder
Create a new fluent API builder from an existing instance.- Parameters:
instance
- an existing instance used as a base for the builder- Returns:
- a builder based on an instance
-
create
Create a new instance with default values.- Returns:
- a new instance
-
discoverServices
boolean discoverServices()Whether to discover services from the class path. When set tofalse
, only services added throughserviceDescriptors()
and/orserviceInstances()
would be available.- Returns:
- whether to discover services from classpath, defaults to
true
-
discoverServicesFromServiceLoader
boolean discoverServicesFromServiceLoader()Whether to discover services from Java service loader. SeeServiceDiscovery.SERVICES_LOADER_RESOURCE
.- Returns:
- whether to discover Java
ServiceLoader
services from classpath (a curated list only), defaults totrue
-
allowLateBinding
boolean allowLateBinding()Whether to allow binding via methods, such asServices.set(Class, Object[])
. When disabled, attempts at late binding will throw an exception.- Returns:
- whether late binding is enabled, defaults to
true
-
serviceDescriptors
List<ServiceDescriptor<?>> serviceDescriptors()Manually registered service descriptors to add to the registry. This is useful whendiscoverServices()
is set tofalse
, to register only hand-picked services into the registry.Even when service discovery is used, this can be used to add service descriptors that are not part of a service discovery mechanism (such as testing services).
- Returns:
- services to register
-
serviceInstances
Map<ServiceDescriptor<?>,Object> serviceInstances()Manually register initial bindings for some of the services in the registry.- Returns:
- service instances to register
-
lookupCacheEnabled
boolean lookupCacheEnabled()Flag indicating whether service lookups (i.e., viaServiceRegistry.first(io.helidon.service.registry.Lookup)
) are cached.- Returns:
- the flag indicating whether service lookups are cached, defaults to
false
-
lookupCacheSize
int lookupCacheSize()Size of the lookup cache whenServiceRegistryConfigBlueprint.lookupCacheEnabled()
is set totrue
.- Returns:
- cache size
-
interceptionEnabled
boolean interceptionEnabled()Flag indicating whether runtime interception is enabled. If set tofalse
, methods will be invoked without any interceptors, even if interceptors are available.- Returns:
- whether to intercept calls at runtime, defaults to
true
-
limitActivationPhase
ActivationPhase limitActivationPhase()In certain conditions Injection services should be initialized but not started (i.e., avoiding calls toPostConstruct
etc.). This can be used in special cases where the normal Injection startup should limit lifecycle up to a given phase.- Returns:
- the phase to stop at during lifecycle
-
useBinding
boolean useBinding()Flag indicating whether compile-time generatedBinding
's should be used at initialization when starting the registry usingServiceRegistryManager.start(Binding)
.This option is ignored when starting the service registry in any other way.
- Returns:
- the flag indicating whether the provider is permitted to use binding generated code from compile-time,
defaults to
true
- See Also:
-
maxRunLevel
double maxRunLevel()Maximal run level to handle when starting fromServiceRegistryManager.start(Binding)
. This setting is ignored when starting registry using other means, as run levels are not handled by default.- Returns:
- maximal run level to lookup during application startup when using generated binding
-
runLevels
Run levels that should be initialized at startup. GeneratedBinding
will configure all declared run levels of services in the application.Note that the result WILL be ordered before use, so initialization will always be handled from the smallest run level to the highest.
- Returns:
- run levels to initialize, up to
maxRunLevel()
, only used when starting the registry throughServiceRegistryManager.start(Binding)
orServiceRegistryManager.start(Binding, ServiceRegistryConfig)
-