java类org.springframework.web.context.support.StandardServletEnvironment的实例源码

EnvironmentIntegrationTests.java 文件源码 项目:class-guard 阅读 22 收藏 0 点赞 0 评论 0
private void assertHasStandardServletEnvironment(WebApplicationContext ctx) {
    // ensure a default servlet environment exists
    Environment defaultEnv = ctx.getEnvironment();
    assertThat(defaultEnv, notNullValue());
    assertThat(defaultEnv, instanceOf(StandardServletEnvironment.class));
}
StandardPortletEnvironment.java 文件源码 项目:spring4-understanding 阅读 18 收藏 0 点赞 0 评论 0
/**
 * Customize the set of property sources with those contributed by superclasses as
 * well as those appropriate for standard portlet-based environments:
 * <ul>
 * <li>{@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME}
 * <li>{@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME}
 * <li>{@linkplain StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
 * <li>{@linkplain StandardServletEnvironment#JNDI_PROPERTY_SOURCE_NAME "jndiProperties"}
 * </ul>
 * <p>Properties present in {@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME} will
 * take precedence over those in {@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME},
 * which takes precedence over those in {@linkplain
 * StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
 * and so on.
 * <p>Properties in any of the above will take precedence over system properties and
 * environment variables contributed by the {@link StandardEnvironment} superclass.
 * <p>The property sources are added as stubs for now, and will be
 * {@linkplain PortletApplicationContextUtils#initPortletPropertySources fully
 * initialized} once the actual {@link PortletConfig}, {@link PortletContext}, and
 * {@link ServletContext} objects are available.
 * @see StandardEnvironment#customizePropertySources
 * @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
 * @see PortletConfigPropertySource
 * @see PortletContextPropertySource
 * @see PortletApplicationContextUtils#initPortletPropertySources
 */
@Override
protected void customizePropertySources(MutablePropertySources propertySources) {
    propertySources.addLast(new StubPropertySource(PORTLET_CONFIG_PROPERTY_SOURCE_NAME));
    propertySources.addLast(new StubPropertySource(PORTLET_CONTEXT_PROPERTY_SOURCE_NAME));
    propertySources.addLast(new StubPropertySource(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME));
    if (JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable()) {
        propertySources.addLast(new JndiPropertySource(StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME));
    }
    super.customizePropertySources(propertySources);
}
StandardPortletEnvironment.java 文件源码 项目:class-guard 阅读 20 收藏 0 点赞 0 评论 0
/**
 * Customize the set of property sources with those contributed by superclasses as
 * well as those appropriate for standard portlet-based environments:
 * <ul>
 * <li>{@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME}
 * <li>{@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME}
 * <li>{@linkplain StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
 * <li>{@linkplain StandardServletEnvironment#JNDI_PROPERTY_SOURCE_NAME "jndiProperties"}
 * </ul>
 * <p>Properties present in {@value #PORTLET_CONFIG_PROPERTY_SOURCE_NAME} will
 * take precedence over those in {@value #PORTLET_CONTEXT_PROPERTY_SOURCE_NAME},
 * which takes precedence over those in {@linkplain
 * StandardServletEnvironment#SERVLET_CONTEXT_PROPERTY_SOURCE_NAME "servletContextInitParams"}
 * and so on.
 * <p>Properties in any of the above will take precedence over system properties and
 * environment variables contributed by the {@link StandardEnvironment} superclass.
 * <p>The property sources are added as stubs for now, and will be
 * {@linkplain PortletApplicationContextUtils#initPortletPropertySources fully
 * initialized} once the actual {@link PortletConfig}, {@link PortletContext}, and
 * {@link ServletContext} objects are available.
 * @see StandardEnvironment#customizePropertySources
 * @see org.springframework.core.env.AbstractEnvironment#customizePropertySources
 * @see PortletConfigPropertySource
 * @see PortletContextPropertySource
 * @see PortletApplicationContextUtils#initPortletPropertySources
 */
@Override
protected void customizePropertySources(MutablePropertySources propertySources) {
    propertySources.addLast(new StubPropertySource(PORTLET_CONFIG_PROPERTY_SOURCE_NAME));
    propertySources.addLast(new StubPropertySource(PORTLET_CONTEXT_PROPERTY_SOURCE_NAME));
    propertySources.addLast(new StubPropertySource(StandardServletEnvironment.SERVLET_CONTEXT_PROPERTY_SOURCE_NAME));
    if (JndiLocatorDelegate.isDefaultJndiEnvironmentAvailable()) {
        propertySources.addLast(new JndiPropertySource(StandardServletEnvironment.JNDI_PROPERTY_SOURCE_NAME));
    }
    super.customizePropertySources(propertySources);
}
HttpServletBean.java 文件源码 项目:spring4-understanding 阅读 21 收藏 0 点赞 0 评论 0
/**
 * Create and return a new {@link StandardServletEnvironment}. Subclasses may override
 * in order to configure the environment or specialize the environment type returned.
 */
protected ConfigurableEnvironment createEnvironment() {
    return new StandardServletEnvironment();
}
HttpServletBean.java 文件源码 项目:class-guard 阅读 26 收藏 0 点赞 0 评论 0
/**
 * Create and return a new {@link StandardServletEnvironment}. Subclasses may override
 * in order to configure the environment or specialize the environment type returned.
 */
protected ConfigurableEnvironment createEnvironment() {
    return new StandardServletEnvironment();
}


问题


面经


文章

微信
公众号

扫码关注公众号