public class DynamicSource<T> extends AbstractSource<T> implements Source<T>
A dynamic Source implementation which applies a different loading strategy
contingent on the path contents.
"file://" or "http://" will be loaded by the
URLSource"classpath://" will be loaded by the
ClasspathFileSourceFor example:
Source that loads files from
the file system:
new DynamicSource("file:///path/my-file.properties")
Source that loads a file
resource from the Java classpath:
new DynamicSource("classpath://my-file.properties")
If unable to determine the source by prefix, the system will do best efforts
to load the object by applying different Source implementations.
FileSource,
ClasspathFileSource| Constructor and Description |
|---|
DynamicSource(String path)
Builds a new dynamic configuration source from a specific path.
|
| Modifier and Type | Method and Description |
|---|---|
T |
load(Mapper<T> mapper)
Applies a specific configuration loading strategy and returns a mapped bean containing
the retrieved data, throwing an exception if the operation fails.
|
equals, hashCode, load, toStringpublic DynamicSource(String path)
path - the path for this configuration sourceCopyright © 2021. All rights reserved.