Class EnvJsonPropertySourceLoader
java.lang.Object
io.micronaut.context.env.AbstractPropertySourceLoader
io.micronaut.jackson.core.env.JsonPropertySourceLoader
io.micronaut.jackson.core.env.EnvJsonPropertySourceLoader
- All Implemented Interfaces:
PropertySourceLoader, PropertySourceLocator, PropertySourceReader, Ordered, Toggleable
- Direct Known Subclasses:
CloudFoundryVcapApplicationPropertySourceLoader, CloudFoundryVcapServicesPropertySourceLoader
Reads properties from JSON stored in the environment variables SPRING_APPLICATION_JSON or MICRONAUT_APPLICATION_JSON.
- Since:
- 1.0
- Author:
- Graeme Rocher
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intPosition for the system property source loader in the chain.Fields inherited from class JsonPropertySourceLoader
FILE_EXTENSIONFields inherited from class AbstractPropertySourceLoader
DEFAULT_POSITION, logFields inherited from interface Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected @Nullable Stringprotected Optional<InputStream> intgetOrder()protected Optional<InputStream> readInput(ResourceLoader resourceLoader, String fileName) Methods inherited from class JsonPropertySourceLoader
getExtensions, processInput, readJsonAsMapMethods inherited from class AbstractPropertySourceLoader
createPropertySource, createPropertySource, isLogEnabled, load, loadEnv, processMap, read, setLogEnabledMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface PropertySourceLoader
loadMethods inherited from interface PropertySourceReader
readMethods inherited from interface Toggleable
isEnabled
-
Field Details
-
POSITION
public static final int POSITIONPosition for the system property source loader in the chain.- See Also:
-
-
Constructor Details
-
EnvJsonPropertySourceLoader
public EnvJsonPropertySourceLoader() -
EnvJsonPropertySourceLoader
public EnvJsonPropertySourceLoader(boolean logEnabled)
-
-
Method Details
-
getOrder
public int getOrder()- Specified by:
getOrderin interfaceOrdered- Overrides:
getOrderin classAbstractPropertySourceLoader- Returns:
- The order of the object. Defaults to zero (no order).
-
readInput
- Overrides:
readInputin classAbstractPropertySourceLoader- Parameters:
resourceLoader- The resource loaderfileName- The file name- Returns:
- An input stream wrapped inside an
Optional
-
getEnvValueAsStream
- Returns:
- The JSON as input stream stored in the environment variables
SPRING_APPLICATION_JSONorMICRONAUT_APPLICATION_JSON.
-
getEnvValue
- Returns:
- The JSON stored in the environment variables
SPRING_APPLICATION_JSONorMICRONAUT_APPLICATION_JSON.
-