org.springframework.core.env

Class MutablePropertySources

    • Constructor Detail

      • MutablePropertySources

        public MutablePropertySources(PropertySources propertySources)
        Create a new MutablePropertySources from the given propertySources object, preserving the original order of contained PropertySource objects.
    • Method Detail

      • addFirst

        public void addFirst(PropertySource<?> propertySource)
        Add the given property source object with highest precedence.
      • addLast

        public void addLast(PropertySource<?> propertySource)
        Add the given property source object with lowest precedence.
      • addBefore

        public void addBefore(String relativePropertySourceName,
                     PropertySource<?> propertySource)
        Add the given property source object with precedence immediately higher than the named relative property source.
      • addAfter

        public void addAfter(String relativePropertySourceName,
                    PropertySource<?> propertySource)
        Add the given property source object with precedence immediately lower than than the named relative property source.
      • precedenceOf

        public int precedenceOf(PropertySource<?> propertySource)
        Return the precedence of the given property source, -1 if not found.
      • remove

        public PropertySource<?> remove(String name)
        Remove and return the property source with the given name, null if not found.
        Parameters:
        name - the name of the property source to find and remove
      • replace

        public void replace(String name,
                   PropertySource<?> propertySource)
        Replace the property source with the given name with the given property source object.
        Parameters:
        name - the name of the property source to find and replace
        propertySource - the replacement property source
        Throws:
        IllegalArgumentException - if no property source with the given name is present
        See Also:
        contains(java.lang.String)
      • size

        public int size()
        Return the number of PropertySource objects contained.
      • assertLegalRelativeAddition

        protected void assertLegalRelativeAddition(String relativePropertySourceName,
                                       PropertySource<?> propertySource)
        Ensure that the given property source is not being added relative to itself.
      • removeIfPresent

        protected void removeIfPresent(PropertySource<?> propertySource)
        Log the removal of the given propertySource if it is present.