Package io.micronaut.context.env
Class ConstantPropertySourceLoader
java.lang.Object
io.micronaut.context.env.ConstantPropertySourceLoader
- All Implemented Interfaces:
PropertySourceLoader,PropertySourceLocator,PropertySourceReader,Toggleable
@Internal
public final class ConstantPropertySourceLoader
extends Object
implements PropertySourceLoader
An implementation of the
PropertySourceLoader interface that provides constant property sources
for use in a configuration context.
This class retrieves pre-defined property sources from StaticOptimizations and allows loading of these
property sources either globally or specifically for an active environment.- Since:
- 5.0
- Author:
- Denis Stepanov
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanload(String resourceName, ResourceLoader resourceLoader) Load aPropertySourcefor the givenEnvironment.loadEnv(String resourceName, ResourceLoader resourceLoader, ActiveEnvironment activeEnvironment) Load aPropertySourcefor the givenEnvironment.read(String name, InputStream input) Read a property source from an input stream.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.micronaut.context.env.PropertySourceLoader
loadMethods inherited from interface io.micronaut.context.env.PropertySourceReader
getExtensions, read
-
Constructor Details
-
ConstantPropertySourceLoader
public ConstantPropertySourceLoader()
-
-
Method Details
-
isEnabled
public boolean isEnabled()- Specified by:
isEnabledin interfaceToggleable- Returns:
- Whether the component is enabled
-
load
Description copied from interface:PropertySourceLoaderLoad aPropertySourcefor the givenEnvironment.- Specified by:
loadin interfacePropertySourceLoader- Parameters:
resourceName- The resourceName of the resource to loadresourceLoader- TheResourceLoaderto retrieve the resource- Returns:
- An optional of
PropertySource
-
loadEnv
public Optional<PropertySource> loadEnv(String resourceName, ResourceLoader resourceLoader, ActiveEnvironment activeEnvironment) Description copied from interface:PropertySourceLoaderLoad aPropertySourcefor the givenEnvironment.- Specified by:
loadEnvin interfacePropertySourceLoader- Parameters:
resourceName- The resourceName of the resource to loadresourceLoader- TheResourceLoaderto retrieve the resourceactiveEnvironment- The environment to load- Returns:
- An optional of
PropertySource
-
read
Description copied from interface:PropertySourceReaderRead a property source from an input stream.- Specified by:
readin interfacePropertySourceReader- Parameters:
name- The name of the property sourceinput- The bytes- Returns:
- A map of string to values
- Throws:
IOException- if there is an error processing the property source
-