Class JsonPropertySourceLoader

  • All Implemented Interfaces:
    io.micronaut.context.env.PropertySourceLoader, io.micronaut.context.env.PropertySourceLocator, io.micronaut.context.env.PropertySourceReader, io.micronaut.core.order.Ordered, io.micronaut.core.util.Toggleable

    public class JsonPropertySourceLoader
    extends io.micronaut.context.env.AbstractPropertySourceLoader

    A PropertySourceLoader that reads application.json files if they exist.

    Since:
    1.0
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static java.lang.String FILE_EXTENSION
      File extension for property source loader.
      • Fields inherited from class io.micronaut.context.env.AbstractPropertySourceLoader

        DEFAULT_POSITION, log
      • Fields inherited from interface io.micronaut.core.order.Ordered

        HIGHEST_PRECEDENCE, LOWEST_PRECEDENCE
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      java.util.Set<java.lang.String> getExtensions()  
      protected void processInput​(java.lang.String name, java.io.InputStream input, java.util.Map<java.lang.String,​java.lang.Object> finalMap)  
      protected java.util.Map<java.lang.String,​java.lang.Object> readJsonAsMap​(java.io.InputStream input)  
      • Methods inherited from class io.micronaut.context.env.AbstractPropertySourceLoader

        createPropertySource, getOrder, isLogEnabled, load, loadEnv, processMap, read, readInput, setLogEnabled
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface io.micronaut.context.env.PropertySourceLoader

        load
      • Methods inherited from interface io.micronaut.context.env.PropertySourceReader

        read
      • Methods inherited from interface io.micronaut.core.util.Toggleable

        isEnabled
    • Field Detail

      • FILE_EXTENSION

        public static final java.lang.String FILE_EXTENSION
        File extension for property source loader.
        See Also:
        Constant Field Values
    • Constructor Detail

      • JsonPropertySourceLoader

        public JsonPropertySourceLoader()
      • JsonPropertySourceLoader

        public JsonPropertySourceLoader​(boolean logEnabled)
    • Method Detail

      • getExtensions

        public java.util.Set<java.lang.String> getExtensions()
      • processInput

        protected void processInput​(java.lang.String name,
                                    java.io.InputStream input,
                                    java.util.Map<java.lang.String,​java.lang.Object> finalMap)
                             throws java.io.IOException
        Specified by:
        processInput in class io.micronaut.context.env.AbstractPropertySourceLoader
        Throws:
        java.io.IOException
      • readJsonAsMap

        protected java.util.Map<java.lang.String,​java.lang.Object> readJsonAsMap​(java.io.InputStream input)
                                                                                throws java.io.IOException
        Parameters:
        input - The input stream
        Returns:
        map representation of the json
        Throws:
        java.io.IOException - If the input stream doesn't exist