org.springframework.boot

Class DefaultPropertiesPropertySource

  • java.lang.Object
    • org.springframework.core.env.PropertySource<T>
      • org.springframework.core.env.EnumerablePropertySource<java.util.Map<java.lang.String,java.lang.Object>>
        • org.springframework.core.env.MapPropertySource
          • org.springframework.boot.DefaultPropertiesPropertySource


  • public class DefaultPropertiesPropertySource
    extends org.springframework.core.env.MapPropertySource
    MapPropertySource containing default properties contributed directly to a SpringApplication. By convention, the DefaultPropertiesPropertySource is always the last property source in the Environment.
    Since:
    2.4.0
    • Nested Class Summary

      • Nested classes/interfaces inherited from class org.springframework.core.env.PropertySource

        org.springframework.core.env.PropertySource.StubPropertySource
    • Field Summary

      Fields 
      Modifier and Type Field and Description
      static java.lang.String NAME
      The name of the 'default properties' property source.
      • Fields inherited from class org.springframework.core.env.PropertySource

        logger, name, source
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method and Description
      static void addOrMerge(java.util.Map<java.lang.String,java.lang.Object> source, org.springframework.core.env.MutablePropertySources sources)
      Add a new DefaultPropertiesPropertySource or merge with an existing one.
      static boolean hasMatchingName(org.springframework.core.env.PropertySource<?> propertySource)
      Return true if the given source is named 'defaultProperties'.
      static void ifNotEmpty(java.util.Map<java.lang.String,java.lang.Object> source, java.util.function.Consumer<DefaultPropertiesPropertySource> action)
      Create a consume a new DefaultPropertiesPropertySource instance if the provided source is not empty.
      static void moveToEnd(org.springframework.core.env.ConfigurableEnvironment environment)
      Move the 'defaultProperties' property source so that it's the last source in the given ConfigurableEnvironment.
      static void moveToEnd(org.springframework.core.env.MutablePropertySources propertySources)
      Move the 'defaultProperties' property source so that it's the last source in the given MutablePropertySources.
      • Methods inherited from class org.springframework.core.env.MapPropertySource

        containsProperty, getProperty, getPropertyNames
      • Methods inherited from class org.springframework.core.env.PropertySource

        equals, getName, getSource, hashCode, named, toString
      • Methods inherited from class java.lang.Object

        clone, finalize, getClass, notify, notifyAll, wait, wait, wait
    • Field Detail

      • NAME

        public static final java.lang.String NAME
        The name of the 'default properties' property source.
        See Also:
        Constant Field Values
    • Constructor Detail

      • DefaultPropertiesPropertySource

        public DefaultPropertiesPropertySource(java.util.Map<java.lang.String,java.lang.Object> source)
        Create a new DefaultPropertiesPropertySource with the given Map source.
        Parameters:
        source - the source map
    • Method Detail

      • hasMatchingName

        public static boolean hasMatchingName(org.springframework.core.env.PropertySource<?> propertySource)
        Return true if the given source is named 'defaultProperties'.
        Parameters:
        propertySource - the property source to check
        Returns:
        true if the name matches
      • addOrMerge

        public static void addOrMerge(java.util.Map<java.lang.String,java.lang.Object> source,
                                      org.springframework.core.env.MutablePropertySources sources)
        Add a new DefaultPropertiesPropertySource or merge with an existing one.
        Parameters:
        source - the Map source
        sources - the existing sources
        Since:
        2.4.4
      • moveToEnd

        public static void moveToEnd(org.springframework.core.env.ConfigurableEnvironment environment)
        Move the 'defaultProperties' property source so that it's the last source in the given ConfigurableEnvironment.
        Parameters:
        environment - the environment to update
      • moveToEnd

        public static void moveToEnd(org.springframework.core.env.MutablePropertySources propertySources)
        Move the 'defaultProperties' property source so that it's the last source in the given MutablePropertySources.
        Parameters:
        propertySources - the property sources to update