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 ofConfigurationSourceProvider
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 Constructor Description ResourceConfigurationSourceProvider()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description InputStream
open(String path)
Returns anInputStream
that contains the source of the configuration for the application.
-
-
-
Method Detail
-
open
public InputStream open(String path) throws IOException
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
-
-