org.springframework.core.env

## 接口 EnvironmentCapable

-     public interface EnvironmentCapable

  Interface indicating a component that contains and exposes an `Environment` reference.

  All Spring application contexts are EnvironmentCapable, and the interface is used primarily for performing `instanceof` checks in framework methods that accept BeanFactory instances that may or may not actually be ApplicationContext instances in order to interact with the environment if indeed it is available.

  As mentioned, `ApplicationContext` extends EnvironmentCapable, and thus exposes a `getEnvironment()` method; however, `ConfigurableApplicationContext` redefines `getEnvironment()` and narrows the signature to return a `ConfigurableEnvironment`. The effect is that an Environment object is 'read-only' until it is being accessed from a ConfigurableApplicationContext, at which point it too may be configured.

  从以下版本开始:
    3.1
  作者:
    Chris Beams
  另请参阅:
    `Environment`, `ConfigurableEnvironment`, `org.springframework.context.ConfigurableApplicationContext#getEnvironment()`

- - ### 方法概要

    所有方法 实例方法 抽象方法
    限定符和类型 | 方法和说明
    --- | ---
    `Environment` | `getEnvironment()` Return the `Environment` associated with this component.

- - ### 方法详细资料

    - #### getEnvironment

          Environment getEnvironment()

      Return the `Environment` associated with this component.