org.springframework.core.env

## 接口 PropertyResolver

- 所有已知子接口:
    ConfigurableEnvironment, ConfigurablePropertyResolver, Environment
  所有已知实现类:
    AbstractEnvironment, AbstractPropertyResolver, PropertySourcesPropertyResolver, StandardEnvironment

      public interface PropertyResolver

  Interface for resolving properties against any underlying source.
  从以下版本开始:
    3.1
  作者:
    Chris Beams, Juergen Hoeller
  另请参阅:
    `Environment`, `PropertySourcesPropertyResolver`

- - ### 方法概要

    所有方法 实例方法 抽象方法
    限定符和类型 | 方法和说明
    --- | ---
    `boolean` | `containsProperty(String key)` Return whether the given property key is available for resolution, i.e. if the value for the given key is not `null`.
    `String` | `getProperty(String key)` Return the property value associated with the given key, or `null` if the key cannot be resolved.
    `<T> T` | `getProperty(String key, Class<T> targetType)` Return the property value associated with the given key, or `null` if the key cannot be resolved.
    `<T> T` | `getProperty(String key, Class<T> targetType, T defaultValue)` Return the property value associated with the given key, or `defaultValue` if the key cannot be resolved.
    `String` | `getProperty(String key, String defaultValue)` Return the property value associated with the given key, or `defaultValue` if the key cannot be resolved.
    `String` | `getRequiredProperty(String key)` Return the property value associated with the given key (never `null`).
    `<T> T` | `getRequiredProperty(String key, Class<T> targetType)` Return the property value associated with the given key, converted to the given targetType (never `null`).
    `String` | `resolvePlaceholders(String text)` Resolve ${...} placeholders in the given text, replacing them with corresponding property values as resolved by `getProperty(java.lang.String)`.
    `String` | `resolveRequiredPlaceholders(String text)` Resolve ${...} placeholders in the given text, replacing them with corresponding property values as resolved by `getProperty(java.lang.String)`.

- - ### 方法详细资料

    - #### containsProperty

          boolean containsProperty(String key)

      Return whether the given property key is available for resolution, i.e. if the value for the given key is not `null`.

    - #### getProperty

          @Nullable
          String getProperty(String key)

      Return the property value associated with the given key, or `null` if the key cannot be resolved.
      参数:
        `key` - the property name to resolve
      另请参阅:
        `getProperty(String, String)`, `getProperty(String, Class)`, `getRequiredProperty(String)`

    - #### getProperty

          String getProperty(String key,
                             String defaultValue)

      Return the property value associated with the given key, or `defaultValue` if the key cannot be resolved.
      参数:
        `key` - the property name to resolve
        `defaultValue` - the default value to return if no value is found
      另请参阅:
        `getRequiredProperty(String)`, `getProperty(String, Class)`

    - #### getProperty

          @Nullable
          <T> T getProperty(String key,
                                       Class<T> targetType)

      Return the property value associated with the given key, or `null` if the key cannot be resolved.
      参数:
        `key` - the property name to resolve
        `targetType` - the expected type of the property value
      另请参阅:
        `getRequiredProperty(String, Class)`

    - #### getProperty

          <T> T getProperty(String key,
                            Class<T> targetType,
                            T defaultValue)

      Return the property value associated with the given key, or `defaultValue` if the key cannot be resolved.
      参数:
        `key` - the property name to resolve
        `targetType` - the expected type of the property value
        `defaultValue` - the default value to return if no value is found
      另请参阅:
        `getRequiredProperty(String, Class)`

    - #### getRequiredProperty

          String getRequiredProperty(String key)
                              throws IllegalStateException

      Return the property value associated with the given key (never `null`).
      抛出:
        `IllegalStateException` - if the key cannot be resolved
      另请参阅:
        `getRequiredProperty(String, Class)`

    - #### getRequiredProperty

          <T> T getRequiredProperty(String key,
                                    Class<T> targetType)
                             throws IllegalStateException

      Return the property value associated with the given key, converted to the given targetType (never `null`).
      抛出:
        `IllegalStateException` - if the given key cannot be resolved

    - #### resolvePlaceholders

          String resolvePlaceholders(String text)

      Resolve ${...} placeholders in the given text, replacing them with corresponding property values as resolved by `getProperty(java.lang.String)`. Unresolvable placeholders with no default value are ignored and passed through unchanged.
      参数:
        `text` - the String to resolve
      返回:
        the resolved String (never `null`)
      抛出:
        `IllegalArgumentException` - if given text is `null`
      另请参阅:
        `resolveRequiredPlaceholders(java.lang.String)`, `SystemPropertyUtils.resolvePlaceholders(String)`

    - #### resolveRequiredPlaceholders

          String resolveRequiredPlaceholders(String text)
                                      throws IllegalArgumentException

      Resolve ${...} placeholders in the given text, replacing them with corresponding property values as resolved by `getProperty(java.lang.String)`. Unresolvable placeholders with no default value will cause an IllegalArgumentException to be thrown.
      返回:
        the resolved String (never `null`)
      抛出:
        `IllegalArgumentException` - if given text is `null` or if any placeholders are unresolvable
      另请参阅:
        `SystemPropertyUtils.resolvePlaceholders(String, boolean)`