public abstract class PriorityConfigProvider<T>
extends util.spring.io.FifoResource<T>
implements util.config.ConfigProvider<T>
ConfigProvider
beans that prioritize where
configuration is read from.
This class first attempts to read configuration items from a file named
fn
in the base configuration directory
, where
where fn
is the value returned by the getConfigFileName
method; if no such file is found there, then an attempt
is made to read the file from the class path at /config/fn
. Failing
that, if fall-back
configuration has been specified,
then those items are returned; otherwise an empty stream is returned, meaning
no configuration is available.Constructor and Description |
---|
PriorityConfigProvider() |
Modifier and Type | Method and Description |
---|---|
abstract java.lang.String |
getConfigFileName()
Subclasses implement this method to specify the name of the configuration
file to read data from.
|
protected org.springframework.core.io.ResourceLoader |
getResourceLoader() |
java.util.stream.Stream<T> |
readConfig()
Reads all the objects in the configuration file.
|
java.util.stream.Stream<T> |
readConfig(util.spring.io.ResourceLocation... loci)
Reads configuration from the first available out of the specified
locations, falling back to hard-coded configuration if no file is
available.
|
protected org.springframework.core.io.ResourceLoader getResourceLoader()
getResourceLoader
in class util.spring.io.FifoResource<T>
public abstract java.lang.String getConfigFileName()
public java.util.stream.Stream<T> readConfig() throws java.lang.Exception
readConfig
in interface util.config.ConfigProvider<T>
null
.java.lang.Exception
public java.util.stream.Stream<T> readConfig(util.spring.io.ResourceLocation... loci) throws java.lang.Exception
loci
- configuration locations.java.lang.Exception
- if an error occurs.