Java 类org.springframework.web.context.ServletConfigAware 实例源码

项目:lams    文件:AbstractRefreshableWebApplicationContext.java   
/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
    WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}
项目:lams    文件:ServletContextAwareProcessor.java   
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (getServletContext() != null && bean instanceof ServletContextAware) {
        ((ServletContextAware) bean).setServletContext(getServletContext());
    }
    if (getServletConfig() != null && bean instanceof ServletConfigAware) {
        ((ServletConfigAware) bean).setServletConfig(getServletConfig());
    }
    return bean;
}
项目:spring4-understanding    文件:ServletContextAwareProcessor.java   
@Override
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (getServletContext() != null && bean instanceof ServletContextAware) {
        ((ServletContextAware) bean).setServletContext(getServletContext());
    }
    if (getServletConfig() != null && bean instanceof ServletConfigAware) {
        ((ServletConfigAware) bean).setServletConfig(getServletConfig());
    }
    return bean;
}
项目:spring4-understanding    文件:StaticWebApplicationContext.java   
/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
    WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}
项目:sdcct    文件:SdcctWebApplicationContext.java   
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    SdcctServletConfig servletConfig = new SdcctServletConfig();
    this.setServletConfig(servletConfig);

    beanFactory.registerSingleton(AbstractRefreshableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, servletConfig);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

    super.postProcessBeanFactory(beanFactory);
}
项目:crigtt    文件:CrigttWebApplicationContext.java   
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    CrigttServletConfig servletConfig = new CrigttServletConfig();
    this.setServletConfig(servletConfig);

    beanFactory.registerSingleton(AbstractRefreshableWebApplicationContext.SERVLET_CONFIG_BEAN_NAME, servletConfig);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

    super.postProcessBeanFactory(beanFactory);
}
项目:class-guard    文件:ServletContextAwareProcessor.java   
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
    if (this.servletContext != null && bean instanceof ServletContextAware) {
        ((ServletContextAware) bean).setServletContext(this.servletContext);
    }
    if (this.servletConfig != null && bean instanceof ServletConfigAware) {
        ((ServletConfigAware) bean).setServletConfig(this.servletConfig);
    }
    return bean;
}
项目:class-guard    文件:StaticWebApplicationContext.java   
/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
    WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}
项目:class-guard    文件:AbstractRefreshableWebApplicationContext.java   
/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
    WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}
项目:spring-osgi    文件:OsgiBundleXmlWebApplicationContext.java   
/**
 * {@inheritDoc}
 * 
 * Registers request/session scopes, a {@link ServletContextAwareProcessor},
 * etc.
 */
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    super.postProcessBeanFactory(beanFactory);

    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);
    beanFactory.registerResolvableDependency(ServletContext.class, this.servletContext);
    beanFactory.registerResolvableDependency(ServletConfig.class, this.servletConfig);

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory);
}
项目:spring-osgi    文件:OsgiBundleXmlWebApplicationContextTest.java   
public void testPostProcessBeanFactoryConfigurableListableBeanFactory() {

        ConfigurableListableBeanFactory mock = new DefaultListableBeanFactory() {

            public void ignoreDependencyInterface(Class ifc) {
                ignored.add(ifc);
            }

            public void addBeanPostProcessor(BeanPostProcessor beanPostProcessor) {
                super.addBeanPostProcessor(beanPostProcessor);
                bpp.add(beanPostProcessor.getClass());
            }

            public void registerResolvableDependency(Class dependencyType, Object autowiredValue) {
                super.registerResolvableDependency(dependencyType, autowiredValue);
                resolved.add(dependencyType);
            }
        };

        context.postProcessBeanFactory(mock);

        assertTrue(ignored.contains(ServletConfigAware.class));
        assertTrue(ignored.contains(ServletContextAware.class));
        assertTrue(resolved.contains(ServletContext.class));
        assertTrue(resolved.contains(ServletConfig.class));
        assertTrue(bpp.contains(ServletContextAwareProcessor.class));
    }
项目:lams    文件:StaticWebApplicationContext.java   
/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
    WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}
项目:spring4-understanding    文件:AbstractRefreshableWebApplicationContext.java   
/**
 * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc.
 */
@Override
protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) {
    beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(this.servletContext, this.servletConfig));
    beanFactory.ignoreDependencyInterface(ServletContextAware.class);
    beanFactory.ignoreDependencyInterface(ServletConfigAware.class);

    WebApplicationContextUtils.registerWebApplicationScopes(beanFactory, this.servletContext);
    WebApplicationContextUtils.registerEnvironmentBeans(beanFactory, this.servletContext, this.servletConfig);
}