Package io.dropwizard.configuration
Class ResourceConfigurationSourceProvider
java.lang.Object
io.dropwizard.configuration.ResourceConfigurationSourceProvider
- All Implemented Interfaces:
ConfigurationSourceProvider
public class ResourceConfigurationSourceProvider
extends Object
implements ConfigurationSourceProvider
An implementation of
ConfigurationSourceProvider
which reads the configuration
from a resource file.
In order to abide by the calling conventions of
{ClassLoader#getResourceAsStream} [1], absolute path strings
(i.e. those with leading "/" characters) passed to open(String)
are converted to relative paths by removing the leading "/".
See [1] for more information on resources in Java and how they are loaded at runtime.
[1] https://docs.oracle.com/javase/8/docs/technotes/guides/lang/resources.html
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionReturns anInputStream
that contains the source of the configuration for the application.
-
Constructor Details
-
ResourceConfigurationSourceProvider
public ResourceConfigurationSourceProvider()
-
-
Method Details
-
open
Description copied from interface:ConfigurationSourceProvider
Returns anInputStream
that contains the source of the configuration for the application. The caller is responsible for closing the result.- Specified by:
open
in interfaceConfigurationSourceProvider
- Parameters:
path
- the path to the configuration- Returns:
- an
InputStream
- Throws:
IOException
- if there is an error reading the data atpath
-