@Singleton @Requires(property="micronaut.config-client.enabled", value="true", defaultValue="false") public class DistributedPropertySourceLocator extends Object implements BootstrapPropertySourceLocator
A BootstrapPropertySourceLocator
implementation that uses the ConfigurationClient
to find
available PropertySource
instances from distributed configuration sources.
This implementation using a Blocking operation which is required during bootstrap which is configured to Timeout after
10 seconds. The timeout can be configured with micronaut.config.readTimeout
in configuration
EMPTY_LOCATOR
Constructor and Description |
---|
DistributedPropertySourceLocator(ConfigurationClient configurationClient,
Duration readTimeout) |
Modifier and Type | Method and Description |
---|---|
Iterable<PropertySource> |
findPropertySources(Environment environment)
A blocking interface that will attempt to resolve either remote or local
PropertySource instances
for the current Environment. |
public DistributedPropertySourceLocator(ConfigurationClient configurationClient, @Value(value="${micronaut.config-client.read-timeout:10s}") Duration readTimeout)
configurationClient
- The configuration clientreadTimeout
- The read timeoutpublic Iterable<PropertySource> findPropertySources(Environment environment) throws ConfigurationException
BootstrapPropertySourceLocator
PropertySource
instances
for the current Environment.findPropertySources
in interface BootstrapPropertySourceLocator
environment
- The environmentPropertySource
ConfigurationException
- If the resolve fails and fail fast is set to true