public class

DefaultWebEnvironment

extends DefaultEnvironment
java.lang.Object
   ↳ org.springframework.core.env.AbstractEnvironment
     ↳ org.springframework.core.env.DefaultEnvironment
       ↳ org.springframework.web.context.support.DefaultWebEnvironment

Class Overview

Environment implementation to be used by Servlet-based web applications. All web-related (servlet-based) ApplicationContext classes initialize an instance by default.

Contributes ServletConfig- and ServletContext-based PropertySource instances. See the DefaultWebEnvironment() constructor for details.

After initial bootstrapping, property sources will be searched for the presence of a "jndiPropertySourceEnabled" property; if found, a JndiPropertySource will be added to this environment's PropertySources, with precedence higher than system properties and environment variables, but lower than that of ServletContext and ServletConfig init params.

See Also

Summary

Constants
String SERVLET_CONFIG_PROPERTY_SOURCE_NAME Servlet config init parameters property source name: {@value }
String SERVLET_CONTEXT_PROPERTY_SOURCE_NAME Servlet context init parameters property source name: {@value }
[Expand]
Inherited Constants
From class org.springframework.core.env.DefaultEnvironment
From class org.springframework.core.env.AbstractEnvironment
[Expand]
Inherited Fields
From class org.springframework.core.env.AbstractEnvironment
Public Constructors
DefaultWebEnvironment()
Create a new Environment populated with the property sources contributed by superclasses as well as:
  • {@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME}
  • {@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}
  • (optionally) "jndiPropertySource"

Properties present in {@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME} will take precedence over those in {@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}.

[Expand]
Inherited Methods
From class org.springframework.core.env.AbstractEnvironment
From class java.lang.Object
From interface org.springframework.core.env.ConfigurableEnvironment
From interface org.springframework.core.env.ConfigurablePropertyResolver
From interface org.springframework.core.env.Environment
From interface org.springframework.core.env.PropertyResolver

Constants

public static final String SERVLET_CONFIG_PROPERTY_SOURCE_NAME

Servlet config init parameters property source name: {@value }

Constant Value: "servletConfigInitParams"

public static final String SERVLET_CONTEXT_PROPERTY_SOURCE_NAME

Servlet context init parameters property source name: {@value }

Constant Value: "servletContextInitParams"

Public Constructors

public DefaultWebEnvironment ()

Create a new Environment populated with the property sources contributed by superclasses as well as:

  • {@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME}
  • {@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}
  • (optionally) "jndiPropertySource"

Properties present in {@value #SERVLET_CONFIG_PROPERTY_SOURCE_NAME} will take precedence over those in {@value #SERVLET_CONTEXT_PROPERTY_SOURCE_NAME}. Properties in either will take precedence over system properties and environment variables.

The Servlet-related property sources are added as stubs for now, and will be fully initialized once the actual ServletConfig and ServletContext objects are available.

If the "jndiPropertySourceEnabled" property is present in any of the default property sources, a JndiPropertySource will be added as well, with precedence lower than servlet property sources, but higher than system properties and environment variables.