org.springframework.core.env

## 类 SystemEnvironmentPropertySource

- java.lang.Object
- - org.springframework.core.env.PropertySource<T>
  - - org.springframework.core.env.EnumerablePropertySource<Map<String,Object>>
    - - org.springframework.core.env.MapPropertySource
      - - org.springframework.core.env.SystemEnvironmentPropertySource

-     public class SystemEnvironmentPropertySource
      extends MapPropertySource

  Specialization of `MapPropertySource` designed for use with system environment variables. Compensates for constraints in Bash and other shells that do not allow for variables containing the period character and/or hyphen character; also allows for uppercase variations on property names for more idiomatic shell use.

  For example, a call to `getProperty("foo.bar")` will attempt to find a value for the original property or any 'equivalent' property, returning the first found:

  - `foo.bar` - the original name
  - `foo_bar` - with underscores for periods (if any)
  - `FOO.BAR` - original, with upper case
  - `FOO_BAR` - with underscores and upper case
  Any hyphen variant of the above would work as well, or even mix dot/hyphen variants.

  The same applies for calls to `containsProperty(String)`, which returns `true` if any of the above properties are present, otherwise `false`.

  This feature is particularly useful when specifying active or default profiles as environment variables. The following is not allowable under Bash:

      spring.profiles.active=p1 java -classpath ... MyApp

  However, the following syntax is permitted and is also more conventional:

      SPRING_PROFILES_ACTIVE=p1 java -classpath ... MyApp

  Enable debug- or trace-level logging for this class (or package) for messages explaining when these 'property name resolutions' occur.

  This property source is included by default in `StandardEnvironment` and all its subclasses.

  从以下版本开始:
    3.1
  作者:
    Chris Beams, Juergen Hoeller
  另请参阅:
    `StandardEnvironment`, `AbstractEnvironment.getSystemEnvironment()`, `AbstractEnvironment.ACTIVE_PROFILES_PROPERTY_NAME`

- - ### 嵌套类概要

    - ### 从类继承的嵌套类/接口 org.springframework.core.env.PropertySource

      `PropertySource.StubPropertySource`

  - ### 字段概要

    - ### 从类继承的字段 org.springframework.core.env.PropertySource

      `logger, name, source`

  - ### 构造器概要

    构造器
    构造器和说明
    `SystemEnvironmentPropertySource(String name, Map<String,Object> source)` Create a new `SystemEnvironmentPropertySource` with the given name and delegating to the given `MapPropertySource`.

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `boolean` | `containsProperty(String name)` Return `true` if a property with the given name or any underscore/uppercase variant thereof exists in this property source.
    `Object` | `getProperty(String name)` This implementation returns `true` if a property with the given name or any underscore/uppercase variant thereof exists in this property source.
    `protected boolean` | `isSecurityManagerPresent()`
    `protected String` | `resolvePropertyName(String name)` Check to see if this property source contains a property with the given name, or any underscore / uppercase variation thereof.

    - ### 从类继承的方法 org.springframework.core.env.MapPropertySource

      `getPropertyNames`

    - ### 从类继承的方法 org.springframework.core.env.PropertySource

      `equals, getName, getSource, hashCode, named, toString`

    - ### 从类继承的方法 java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, wait, wait, wait`

- - ### 构造器详细资料

    - #### SystemEnvironmentPropertySource

          public SystemEnvironmentPropertySource(String name,
                                                 Map<String,Object> source)

      Create a new `SystemEnvironmentPropertySource` with the given name and delegating to the given `MapPropertySource`.

  - ### 方法详细资料

    - #### containsProperty

          public boolean containsProperty(String name)

      Return `true` if a property with the given name or any underscore/uppercase variant thereof exists in this property source.
      覆盖:
        `containsProperty` 在类中 `MapPropertySource`
      参数:
        `name` - the name of the property to find

    - #### getProperty

          @Nullable
          public Object getProperty(String name)

      This implementation returns `true` if a property with the given name or any underscore/uppercase variant thereof exists in this property source.
      覆盖:
        `getProperty` 在类中 `MapPropertySource`
      参数:
        `name` - the property to find
      另请参阅:
        `PropertyResolver.getRequiredProperty(String)`

    - #### resolvePropertyName

          protected final String resolvePropertyName(String name)

      Check to see if this property source contains a property with the given name, or any underscore / uppercase variation thereof. Return the resolved name if one is found or otherwise the original name. Never returns `null`.

    - #### isSecurityManagerPresent

          protected boolean isSecurityManagerPresent()