Java Code Examples for org.springframework.web.context.ServletConfigAware

The following are top voted examples for showing how to use org.springframework.web.context.ServletConfigAware. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: lams   File: AbstractRefreshableWebApplicationContext.java   View source code 8 votes vote down vote up
/**
 * 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);
}
 
Example 2
Project: lams   File: ServletContextAwareProcessor.java   View source code 7 votes vote down vote up
@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;
}
 
Example 3
Project: spring4-understanding   File: ServletContextAwareProcessor.java   View source code 5 votes vote down vote up
@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;
}
 
Example 4
Project: spring4-understanding   File: StaticWebApplicationContext.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 5
Project: sdcct   File: SdcctWebApplicationContext.java   View source code 5 votes vote down vote up
@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);
}
 
Example 6
Project: crigtt   File: CrigttWebApplicationContext.java   View source code 5 votes vote down vote up
@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);
}
 
Example 7
Project: class-guard   File: ServletContextAwareProcessor.java   View source code 5 votes vote down vote up
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;
}
 
Example 8
Project: class-guard   File: StaticWebApplicationContext.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 9
Project: class-guard   File: AbstractRefreshableWebApplicationContext.java   View source code 5 votes vote down vote up
/**
 * 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);
}
 
Example 10
Project: spring-osgi   File: OsgiBundleXmlWebApplicationContext.java   View source code 5 votes vote down vote up
/**
 * {@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);
}
 
Example 11
Project: spring-osgi   File: OsgiBundleXmlWebApplicationContextTest.java   View source code 5 votes vote down vote up
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));
	}
 
Example 12
Project: lams   File: StaticWebApplicationContext.java   View source code 4 votes vote down vote up
/**
 * 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);
}
 
Example 13
Project: spring4-understanding   File: AbstractRefreshableWebApplicationContext.java   View source code 4 votes vote down vote up
/**
 * 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);
}