Class StandardServletEnvironment

java.lang.Object
org.springframework.core.env.AbstractEnvironment
org.springframework.core.env.StandardEnvironment
org.springframework.web.context.support.StandardServletEnvironment
All Implemented Interfaces:
org.springframework.core.env.ConfigurableEnvironment, org.springframework.core.env.ConfigurablePropertyResolver, org.springframework.core.env.Environment, org.springframework.core.env.PropertyResolver, ConfigurableWebEnvironment

public class StandardServletEnvironment extends org.springframework.core.env.StandardEnvironment implements ConfigurableWebEnvironment
Environment implementation to be used by Servlet-based web applications. All web-related (servlet-based) ApplicationContext classes initialize an instance by default.

Contributes ServletConfig, ServletContext, and JNDI-based PropertySource instances. See customizePropertySources(org.springframework.core.env.MutablePropertySources) method documentation for details.

Since:
3.1
Author:
Chris Beams, Juergen Hoeller
See Also:
  • StandardEnvironment
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final String
    JNDI property source name: "jndiProperties".
    static final String
    Servlet config init parameters property source name: "servletConfigInitParams".
    static final String
    Servlet context init parameters property source name: "servletContextInitParams".

    Fields inherited from class org.springframework.core.env.StandardEnvironment

    SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME

    Fields inherited from class org.springframework.core.env.AbstractEnvironment

    ACTIVE_PROFILES_PROPERTY_NAME, DEFAULT_PROFILES_PROPERTY_NAME, IGNORE_GETENV_PROPERTY_NAME, logger, RESERVED_DEFAULT_PROFILE_NAME
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
     
    Create a new StandardServletEnvironment instance.
    protected
    StandardServletEnvironment(org.springframework.core.env.MutablePropertySources propertySources)
    Create a new StandardServletEnvironment instance with a specific MutablePropertySources instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    customizePropertySources(org.springframework.core.env.MutablePropertySources propertySources)
    Customize the set of property sources with those contributed by superclasses as well as those appropriate for standard servlet-based environments: "servletConfigInitParams" "servletContextInitParams" "jndiProperties"
    void
    initPropertySources(ServletContext servletContext, ServletConfig servletConfig)
    Replace any stub property source instances acting as placeholders with real servlet context/config property sources using the given parameters.

    Methods inherited from class org.springframework.core.env.AbstractEnvironment

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

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.springframework.core.env.ConfigurableEnvironment

    addActiveProfile, getPropertySources, getSystemEnvironment, getSystemProperties, merge, setActiveProfiles, setDefaultProfiles

    Methods inherited from interface org.springframework.core.env.ConfigurablePropertyResolver

    getConversionService, setConversionService, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredProperties

    Methods inherited from interface org.springframework.core.env.Environment

    acceptsProfiles, acceptsProfiles, getActiveProfiles, getDefaultProfiles

    Methods inherited from interface org.springframework.core.env.PropertyResolver

    containsProperty, getProperty, getProperty, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolvePlaceholders, resolveRequiredPlaceholders
  • Field Details

    • SERVLET_CONTEXT_PROPERTY_SOURCE_NAME

      public static final String SERVLET_CONTEXT_PROPERTY_SOURCE_NAME
      Servlet context init parameters property source name: "servletContextInitParams".
      See Also:
    • SERVLET_CONFIG_PROPERTY_SOURCE_NAME

      public static final String SERVLET_CONFIG_PROPERTY_SOURCE_NAME
      Servlet config init parameters property source name: "servletConfigInitParams".
      See Also:
    • JNDI_PROPERTY_SOURCE_NAME

      public static final String JNDI_PROPERTY_SOURCE_NAME
      JNDI property source name: "jndiProperties".
      See Also:
  • Constructor Details

    • StandardServletEnvironment

      public StandardServletEnvironment()
      Create a new StandardServletEnvironment instance.
    • StandardServletEnvironment

      protected StandardServletEnvironment(org.springframework.core.env.MutablePropertySources propertySources)
      Create a new StandardServletEnvironment instance with a specific MutablePropertySources instance.
      Parameters:
      propertySources - property sources to use
      Since:
      5.3.4
  • Method Details