org.springframework.core.env

## 类 StandardEnvironment

- java.lang.Object
- - org.springframework.core.env.AbstractEnvironment
  - - org.springframework.core.env.StandardEnvironment

- 所有已实现的接口:
    ConfigurableEnvironment, ConfigurablePropertyResolver, Environment, PropertyResolver

      public class StandardEnvironment
      extends AbstractEnvironment

  `Environment` implementation suitable for use in 'standard' (i.e. non-web) applications.

  In addition to the usual functions of a `ConfigurableEnvironment` such as property resolution and profile-related operations, this implementation configures two default property sources, to be searched in the following order:

  - system properties
  - system environment variables
  That is, if the key "xyz" is present both in the JVM system properties as well as in the set of environment variables for the current process, the value of key "xyz" from system properties will return from a call to `environment.getProperty("xyz")`. This ordering is chosen by default because system properties are per-JVM, while environment variables may be the same across many JVMs on a given system. Giving system properties precedence allows for overriding of environment variables on a per-JVM basis.

  These default property sources may be removed, reordered, or replaced; and additional property sources may be added using the `MutablePropertySources` instance available from `AbstractEnvironment.getPropertySources()`. See `ConfigurableEnvironment` Javadoc for usage examples.

  See `SystemEnvironmentPropertySource` javadoc for details on special handling of property names in shell environments (e.g. Bash) that disallow period characters in variable names.

  从以下版本开始:
    3.1
  作者:
    Chris Beams
  另请参阅:
    `ConfigurableEnvironment`, `SystemEnvironmentPropertySource`, `org.springframework.web.context.support.StandardServletEnvironment`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `static String` | `SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME` System environment property source name: "systemEnvironment"
    `static String` | `SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME` JVM system properties property source name: "systemProperties"

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

      `ACTIVE_PROFILES_PROPERTY_NAME, DEFAULT_PROFILES_PROPERTY_NAME, IGNORE_GETENV_PROPERTY_NAME, logger, RESERVED_DEFAULT_PROFILE_NAME`

  - ### 构造器概要

    构造器
    构造器和说明
    `StandardEnvironment()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `protected void` | `customizePropertySources(MutablePropertySources propertySources)` Customize the set of property sources with those appropriate for any standard Java environment: "systemProperties" "systemEnvironment" Properties present in "systemProperties" will take precedence over those in "systemEnvironment".

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

      `acceptsProfiles, addActiveProfile, containsProperty, doGetActiveProfiles, doGetDefaultProfiles, getActiveProfiles, getConversionService, getDefaultProfiles, getProperty, getProperty, getProperty, getProperty, getPropertySources, getRequiredProperty, getRequiredProperty, getReservedDefaultProfiles, getSystemEnvironment, getSystemProperties, isProfileActive, merge, resolvePlaceholders, resolveRequiredPlaceholders, setActiveProfiles, setConversionService, setDefaultProfiles, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, suppressGetenvAccess, toString, validateProfile, validateRequiredProperties`

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

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

- - ### 字段详细资料

    - #### SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME

          public static final String SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME

      System environment property source name: "systemEnvironment"
      另请参阅:
        常量字段值

    - #### SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME

          public static final String SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME

      JVM system properties property source name: "systemProperties"
      另请参阅:
        常量字段值

  - ### 构造器详细资料

    - #### StandardEnvironment

          public StandardEnvironment()

  - ### 方法详细资料

    - #### customizePropertySources

          protected void customizePropertySources(MutablePropertySources propertySources)

      Customize the set of property sources with those appropriate for any standard Java environment:
      - "systemProperties"
      - "systemEnvironment"

      Properties present in "systemProperties" will take precedence over those in "systemEnvironment".

      覆盖:
        `customizePropertySources` 在类中 `AbstractEnvironment`
      另请参阅:
        `AbstractEnvironment.customizePropertySources(MutablePropertySources)`, `AbstractEnvironment.getSystemProperties()`, `AbstractEnvironment.getSystemEnvironment()`