类 StandardServletEnvironment
- java.lang.Object
- org.springframework.core.env.AbstractEnvironment
- org.springframework.core.env.StandardEnvironment
- org.springframework.web.context.support.StandardServletEnvironment
- 所有已实现的接口:
ConfigurableEnvironment
,ConfigurablePropertyResolver
,Environment
,PropertyResolver
,ConfigurableWebEnvironment
public class StandardServletEnvironment extends StandardEnvironment implements ConfigurableWebEnvironment
Environment
implementation to be used byServlet
-based web applications. All web-related (servlet-based)ApplicationContext
classes initialize an instance by default.Contributes
ServletConfig
,ServletContext
, and JNDI-basedPropertySource
instances. SeecustomizePropertySources(org.springframework.core.env.MutablePropertySources)
method documentation for details.- 从以下版本开始:
- 3.1
- 作者:
- Chris Beams
- 另请参阅:
StandardEnvironment
字段概要
字段 修饰符和类型 字段 说明 static String
JNDI_PROPERTY_SOURCE_NAME
JNDI property source name: "jndiProperties"static String
SERVLET_CONFIG_PROPERTY_SOURCE_NAME
Servlet config init parameters property source name: "servletConfigInitParams"static String
SERVLET_CONTEXT_PROPERTY_SOURCE_NAME
Servlet context init parameters property source name: "servletContextInitParams"从类继承的字段 org.springframework.core.env.StandardEnvironment
SYSTEM_ENVIRONMENT_PROPERTY_SOURCE_NAME, SYSTEM_PROPERTIES_PROPERTY_SOURCE_NAME
从类继承的字段 org.springframework.core.env.AbstractEnvironment
ACTIVE_PROFILES_PROPERTY_NAME, DEFAULT_PROFILES_PROPERTY_NAME, IGNORE_GETENV_PROPERTY_NAME, logger, RESERVED_DEFAULT_PROFILE_NAME
构造器概要
构造器 构造器 说明 StandardServletEnvironment()
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 protected void
customizePropertySources(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.从类继承的方法 org.springframework.core.env.AbstractEnvironment
acceptsProfiles, addActiveProfile, containsProperty, doGetActiveProfiles, doGetDefaultProfiles, getActiveProfiles, getConversionService, getDefaultProfiles, getProperty, getProperty, getProperty, getProperty, getPropertyAsClass, getPropertySources, getRequiredProperty, getRequiredProperty, getReservedDefaultProfiles, getSystemEnvironment, getSystemProperties, isProfileActive, merge, resolvePlaceholders, resolveRequiredPlaceholders, setActiveProfiles, setConversionService, setDefaultProfiles, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, suppressGetenvAccess, toString, validateProfile, validateRequiredProperties
从类继承的方法 java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
从接口继承的方法 org.springframework.core.env.ConfigurableEnvironment
addActiveProfile, getPropertySources, getSystemEnvironment, getSystemProperties, merge, setActiveProfiles, setDefaultProfiles
从接口继承的方法 org.springframework.core.env.ConfigurablePropertyResolver
getConversionService, setConversionService, setIgnoreUnresolvableNestedPlaceholders, setPlaceholderPrefix, setPlaceholderSuffix, setRequiredProperties, setValueSeparator, validateRequiredProperties
从接口继承的方法 org.springframework.core.env.Environment
acceptsProfiles, getActiveProfiles, getDefaultProfiles
从接口继承的方法 org.springframework.core.env.PropertyResolver
containsProperty, getProperty, getProperty, getProperty, getProperty, getPropertyAsClass, getRequiredProperty, getRequiredProperty, resolvePlaceholders, resolveRequiredPlaceholders
字段详细资料
SERVLET_CONTEXT_PROPERTY_SOURCE_NAME
public static final String SERVLET_CONTEXT_PROPERTY_SOURCE_NAME
Servlet context init parameters property source name: "servletContextInitParams"- 另请参阅:
- 常量字段值
SERVLET_CONFIG_PROPERTY_SOURCE_NAME
public static final String SERVLET_CONFIG_PROPERTY_SOURCE_NAME
Servlet config init parameters property source name: "servletConfigInitParams"- 另请参阅:
- 常量字段值
JNDI_PROPERTY_SOURCE_NAME
public static final String JNDI_PROPERTY_SOURCE_NAME
JNDI property source name: "jndiProperties"- 另请参阅:
- 常量字段值
构造器详细资料
StandardServletEnvironment
public StandardServletEnvironment()
方法详细资料
customizePropertySources
protected void customizePropertySources(MutablePropertySources propertySources)
Customize 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
StandardEnvironment
superclass.The
Servlet
-related property sources are added asstubs
at this stage, and will be fully initialized once the actualServletContext
object becomes available.- 覆盖:
customizePropertySources
在类中StandardEnvironment
- 另请参阅:
StandardEnvironment.customizePropertySources(org.springframework.core.env.MutablePropertySources)
,AbstractEnvironment.customizePropertySources(org.springframework.core.env.MutablePropertySources)
,ServletConfigPropertySource
,ServletContextPropertySource
,JndiPropertySource
,AbstractApplicationContext.initPropertySources()
,initPropertySources(ServletContext, ServletConfig)
initPropertySources
public void initPropertySources(ServletContext servletContext, ServletConfig servletConfig)
从接口复制的说明:ConfigurableWebEnvironment
Replace any stub property source instances acting as placeholders with real servlet context/config property sources using the given parameters.- 指定者:
initPropertySources
在接口中ConfigurableWebEnvironment
- 参数:
servletContext
- theServletContext
(may not benull
)servletConfig
- theServletConfig
(null
if not available)- 另请参阅:
WebApplicationContextUtils.initServletPropertySources( org.springframework.core.env.MutablePropertySources, ServletContext, ServletConfig)