Class StandardServletEnvironment
- All Implemented Interfaces:
- ConfigurableEnvironment,- ConfigurablePropertyResolver,- Environment,- PropertyResolver,- 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:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final StringJNDI property source name: "jndiProperties".static final StringServlet config init parameters property source name: "servletConfigInitParams".static final StringServlet context init parameters property source name: "servletContextInitParams".Fields inherited from class org.springframework.core.env.StandardEnvironmentSYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAMEFields inherited from class org.springframework.core.env.AbstractEnvironmentACTIVE_PROFILES_PROPERTY_NAME, DEFAULT_PROFILES_PROPERTY_NAME, IGNORE_GETENV_PROPERTY_NAME, logger, RESERVED_DEFAULT_PROFILE_NAME
- 
Constructor SummaryConstructorsModifierConstructorDescriptionCreate a newStandardServletEnvironmentinstance.protectedStandardServletEnvironment(MutablePropertySources propertySources) Create a newStandardServletEnvironmentinstance with a specificMutablePropertySourcesinstance.
- 
Method SummaryModifier and TypeMethodDescriptionprotected voidcustomizePropertySources(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"voidinitPropertySources(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.AbstractEnvironmentacceptsProfiles, 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, validateRequiredPropertiesMethods inherited from class java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.springframework.core.env.ConfigurableEnvironmentaddActiveProfile, getPropertySources, getSystemEnvironment, getSystemProperties, merge, setActiveProfiles, setDefaultProfilesMethods inherited from interface org.springframework.core.env.ConfigurablePropertyResolvergetConversionService, setConversionService, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredPropertiesMethods inherited from interface org.springframework.core.env.EnvironmentacceptsProfiles, acceptsProfiles, getActiveProfiles, getDefaultProfilesMethods inherited from interface org.springframework.core.env.PropertyResolvercontainsProperty, getProperty, getProperty, getProperty, getProperty, getRequiredProperty, getRequiredProperty, resolvePlaceholders, resolveRequiredPlaceholders
- 
Field Details- 
SERVLET_CONTEXT_PROPERTY_SOURCE_NAMEServlet context init parameters property source name: "servletContextInitParams".- See Also:
 
- 
SERVLET_CONFIG_PROPERTY_SOURCE_NAMEServlet config init parameters property source name: "servletConfigInitParams".- See Also:
 
- 
JNDI_PROPERTY_SOURCE_NAMEJNDI property source name: "jndiProperties".- See Also:
 
 
- 
- 
Constructor Details- 
StandardServletEnvironmentpublic StandardServletEnvironment()Create a newStandardServletEnvironmentinstance.
- 
StandardServletEnvironmentCreate a newStandardServletEnvironmentinstance with a specificMutablePropertySourcesinstance.- Parameters:
- propertySources- property sources to use
- Since:
- 5.3.4
 
 
- 
- 
Method Details- 
customizePropertySourcesCustomize the set of property sources with those contributed by superclasses as well as those appropriate for standard servlet-based environments:Properties present in "servletConfigInitParams" will take precedence over those in "servletContextInitParams", and properties found in either of the above take precedence over those found in "jndiProperties". Properties in any of the above will take precedence over system properties and environment variables contributed by the StandardEnvironmentsuperclass.The Servlet-related property sources are added asstubsat this stage, and will be fully initialized once the actualServletContextobject becomes available.Addition of "jndiProperties" can be disabled with JndiLocatorDelegate.IGNORE_JNDI_PROPERTY_NAME.- Overrides:
- customizePropertySourcesin class- StandardEnvironment
- See Also:
- 
- StandardEnvironment.customizePropertySources(org.springframework.core.env.MutablePropertySources)
- AbstractEnvironment.customizePropertySources(org.springframework.core.env.MutablePropertySources)
- ServletConfigPropertySource
- ServletContextPropertySource
- JndiPropertySource
- AbstractApplicationContext.initPropertySources()
- initPropertySources(ServletContext, ServletConfig)
 
 
- 
initPropertySourcespublic void initPropertySources(@Nullable ServletContext servletContext, @Nullable ServletConfig servletConfig) Description copied from interface:ConfigurableWebEnvironmentReplace any stub property source instances acting as placeholders with real servlet context/config property sources using the given parameters.- Specified by:
- initPropertySourcesin interface- ConfigurableWebEnvironment
- Parameters:
- servletContext- the- ServletContext(may not be- null)
- servletConfig- the- ServletConfig(- nullif not available)
- See Also:
 
 
-