Class ConfigurationSourceProviderWithFallback
- java.lang.Object
-
- no.digipost.dropwizard.configuration.ConfigurationSourceProviderWithFallback
-
- All Implemented Interfaces:
io.dropwizard.configuration.ConfigurationSourceProvider
public class ConfigurationSourceProviderWithFallback extends Object implements io.dropwizard.configuration.ConfigurationSourceProvider
This allows for trying to resolve configuration source from several types of locations. If the first provider throws anIOException, a second attempt is done with a fallback provider. The typical composition of providers is to first try using aFileConfigurationSourceProvider, and then aResourceConfigurationSourceProvider.new ConfigurationSourceProviderWithFallback( new FileConfigurationSourceProvider(), new ResourceConfigurationSourceProvider() )
-
-
Constructor Summary
Constructors Constructor Description ConfigurationSourceProviderWithFallback(io.dropwizard.configuration.ConfigurationSourceProvider main, io.dropwizard.configuration.ConfigurationSourceProvider fallback)
-
-
-
Method Detail
-
open
public final InputStream open(String path) throws IOException
- Specified by:
openin interfaceio.dropwizard.configuration.ConfigurationSourceProvider- Throws:
ConfigurationSourceNotFoundException- if both providers fails withIOExceptiontrying to resolve a configuration source from the givenpath. The thrown exception will contain the exception from the main provider as cause, and the exception from the second provider as suppressed.IOException
-
-