org.springframework.core.env

Class PropertySourcesPropertyResolver

    • Constructor Detail

      • PropertySourcesPropertyResolver

        public PropertySourcesPropertyResolver(@Nullable
                                               PropertySources propertySources)
        Create a new resolver against the given property sources.
        Parameters:
        propertySources - the set of PropertySource objects to use
    • Method Detail

      • getProperty

        @Nullable
        public <T> T getProperty(java.lang.String key,
                                           java.lang.Class<T> targetValueType)
        Description copied from interface: PropertyResolver
        Return the property value associated with the given key, or null if the key cannot be resolved.
        Parameters:
        key - the property name to resolve
        targetValueType - the expected type of the property value
        See Also:
        PropertyResolver.getRequiredProperty(String, Class)
      • getPropertyAsRawString

        @Nullable
        protected java.lang.String getPropertyAsRawString(java.lang.String key)
        Description copied from class: AbstractPropertyResolver
        Retrieve the specified property as a raw String, i.e. without resolution of nested placeholders.
        Specified by:
        getPropertyAsRawString in class AbstractPropertyResolver
        Parameters:
        key - the property name to resolve
        Returns:
        the property value or null if none found
      • getProperty

        @Nullable
        protected <T> T getProperty(java.lang.String key,
                                              java.lang.Class<T> targetValueType,
                                              boolean resolveNestedPlaceholders)
      • logKeyFound

        protected void logKeyFound(java.lang.String key,
                                   PropertySource<?> propertySource,
                                   java.lang.Object value)
        Log the given key as found in the given PropertySource, resulting in the given value.

        The default implementation writes a debug log message with key and source. As of 4.3.3, this does not log the value anymore in order to avoid accidental logging of sensitive settings. Subclasses may override this method to change the log level and/or log message, including the property's value if desired.

        Parameters:
        key - the key found
        propertySource - the PropertySource that the key has been found in
        value - the corresponding value
        Since:
        4.3.1