org.springframework.core.env

## Interface EnvironmentCapable

- All Known Subinterfaces:
    ApplicationContext, ConfigurableApplicationContext, ConfigurablePortletApplicationContext, ConfigurableWebApplicationContext, WebApplicationContext
  All Known Implementing Classes:
    AbstractApplicationContext, AbstractBeanDefinitionReader, AbstractRefreshableApplicationContext, AbstractRefreshableConfigApplicationContext, AbstractRefreshablePortletApplicationContext, AbstractRefreshableWebApplicationContext, AbstractXmlApplicationContext, AnnotationConfigApplicationContext, AnnotationConfigWebApplicationContext, ClassPathBeanDefinitionScanner, ClassPathScanningCandidateComponentProvider, ClassPathXmlApplicationContext, DispatcherPortlet, DispatcherServlet, FileSystemXmlApplicationContext, FrameworkPortlet, FrameworkServlet, GenericApplicationContext, GenericPortletBean, GenericWebApplicationContext, GenericXmlApplicationContext, HttpServletBean, PropertiesBeanDefinitionReader, ResourceAdapterApplicationContext, ResourceServlet, StaticApplicationContext, StaticPortletApplicationContext, StaticWebApplicationContext, XmlBeanDefinitionReader, XmlPortletApplicationContext, XmlWebApplicationContext

      public interface EnvironmentCapable

  Interface indicating a component contains and makes available an `Environment` object.

  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 accessed from a ConfigurableApplicationContext, at which point it too may be configured.

  Since:
    3.1
  Author:
    Chris Beams
  See Also:
    `Environment`, `ConfigurableEnvironment`, `ConfigurableApplicationContext.getEnvironment()`

- - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `Environment` | `getEnvironment()` Return the Environment for this object

- - ### Method Detail

    - #### getEnvironment

          Environment getEnvironment()

      Return the Environment for this object