Class EnvJsonPropertySourceLoader

All Implemented Interfaces:
PropertySourceLoader, PropertySourceLocator, PropertySourceReader, Ordered, Toggleable
Direct Known Subclasses:
CloudFoundryVcapApplicationPropertySourceLoader, CloudFoundryVcapServicesPropertySourceLoader

@Internal public class EnvJsonPropertySourceLoader extends JsonPropertySourceLoader

Reads properties from JSON stored in the environment variables SPRING_APPLICATION_JSON or MICRONAUT_APPLICATION_JSON.

Since:
1.0
Author:
Graeme Rocher
  • Field Details

    • POSITION

      public static final int POSITION
      Position 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:
      getOrder in interface Ordered
      Overrides:
      getOrder in class AbstractPropertySourceLoader
      Returns:
      The order of the object. Defaults to zero (no order).
    • readInput

      protected Optional<InputStream> readInput(ResourceLoader resourceLoader, String fileName)
      Overrides:
      readInput in class AbstractPropertySourceLoader
      Parameters:
      resourceLoader - The resource loader
      fileName - The file name
      Returns:
      An input stream wrapped inside an Optional
    • getEnvValueAsStream

      protected Optional<InputStream> getEnvValueAsStream()
      Returns:
      The JSON as input stream stored in the environment variables SPRING_APPLICATION_JSON or MICRONAUT_APPLICATION_JSON.
    • getEnvValue

      protected String getEnvValue()
      Returns:
      The JSON stored in the environment variables SPRING_APPLICATION_JSON or MICRONAUT_APPLICATION_JSON.