List of usage examples for org.springframework.web.context.support WebApplicationContextUtils registerWebApplicationScopes
public static void registerWebApplicationScopes(ConfigurableListableBeanFactory beanFactory)
From source file:fi.eis.applications.osgi.support.OsgiBundleXmlWebApplicationContext.java
/** * {@inheritDoc}//from ww w.j a va 2s. c o m * * 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); }
From source file:br.com.caelum.vraptor.ioc.spring.SpringRegistry.java
void configure() { registerVRaptorComponents();/*w ww. j a v a 2 s . c o m*/ AnnotationConfigUtils.registerAnnotationConfigProcessors((BeanDefinitionRegistry) beanFactory); AopConfigUtils.registerAspectJAnnotationAutoProxyCreatorIfNecessary((BeanDefinitionRegistry) beanFactory); registerCustomInjectionProcessor(); registerCachedComponentsOn(); WebApplicationContextUtils.registerWebApplicationScopes(beanFactory); }
From source file:ro.codecamp.ebp.core.util.ServerOsgiBundleXmlWebApplicationContext.java
/** * Register request/session scopes, a {@link ServletContextAwareProcessor}, etc. * /*from w w w . ja va 2s . c o m*/ * @see WebApplicationContextUtils#registerWebApplicationScopes(ConfigurableListableBeanFactory) */ @Override protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { super.postProcessBeanFactory(beanFactory); // Drive the kernel's bean factory post processors. BundleContext bundleContext = getBundleContext(); if (bundleContext != null) { ServiceReference sr = bundleContext.getServiceReference(OsgiBeanFactoryPostProcessor.class); if (sr != null) { OsgiBeanFactoryPostProcessor kernelPostProcessor = (OsgiBeanFactoryPostProcessor) bundleContext .getService(sr); try { kernelPostProcessor.postProcessBeanFactory(bundleContext, beanFactory); } catch (Exception e) { throw new ApplicationContextException("Kernel bean factory post processor failed", e); } finally { bundleContext.ungetService(sr); } } } beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(), getServletConfig())); beanFactory.ignoreDependencyInterface(ServletContextAware.class); beanFactory.ignoreDependencyInterface(ServletConfigAware.class); beanFactory.registerResolvableDependency(ServletContext.class, getServletContext()); beanFactory.registerResolvableDependency(ServletConfig.class, getServletConfig()); WebApplicationContextUtils.registerWebApplicationScopes(beanFactory); }
From source file:com.productone.spring.ServerOsgiBundleXmlWebApplicationContext.java
/** * Register request/session scopes, a {@link ServletContextAwareProcessor}, * etc./*from w w w . j a va 2 s . com*/ * * @see * WebApplicationContextUtils#registerWebApplicationScopes(ConfigurableListableBeanFactory) */ @Override protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { super.postProcessBeanFactory(beanFactory); // Drive the kernel's bean factory post processors. BundleContext bundleContext = getBundleContext(); if (bundleContext != null) { ServiceReference sr = bundleContext.getServiceReference(OsgiBeanFactoryPostProcessor.class.getName()); if (sr != null) { OsgiBeanFactoryPostProcessor kernelPostProcessor = (OsgiBeanFactoryPostProcessor) bundleContext .getService(sr); try { kernelPostProcessor.postProcessBeanFactory(bundleContext, beanFactory); } catch (Exception e) { throw new ApplicationContextException("Kernel bean factory post processor failed", e); } finally { bundleContext.ungetService(sr); } } } beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(), getServletConfig())); beanFactory.ignoreDependencyInterface(ServletContextAware.class); beanFactory.ignoreDependencyInterface(ServletConfigAware.class); beanFactory.registerResolvableDependency(ServletContext.class, getServletContext()); beanFactory.registerResolvableDependency(ServletConfig.class, getServletConfig()); WebApplicationContextUtils.registerWebApplicationScopes(beanFactory); }
From source file:net.solarnetwork.web.gemini.ServerOsgiBundleXmlWebApplicationContext.java
/** * Register request/session scopes, a {@link ServletContextAwareProcessor}, * etc.//from w w w. j a va 2 s.co m * * @see WebApplicationContextUtils#registerWebApplicationScopes(ConfigurableListableBeanFactory) */ @Override protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) { super.postProcessBeanFactory(beanFactory); // Drive the kernel's bean factory post processors. BundleContext bundleContext = getBundleContext(); if (bundleContext != null) { ServiceReference<OsgiBeanFactoryPostProcessor> sr = bundleContext .getServiceReference(OsgiBeanFactoryPostProcessor.class); if (sr != null) { OsgiBeanFactoryPostProcessor kernelPostProcessor = bundleContext.getService(sr); try { kernelPostProcessor.postProcessBeanFactory(bundleContext, beanFactory); } catch (Exception e) { throw new ApplicationContextException("Kernel bean factory post processor failed", e); } finally { bundleContext.ungetService(sr); } } } beanFactory.addBeanPostProcessor(new ServletContextAwareProcessor(getServletContext(), getServletConfig())); beanFactory.ignoreDependencyInterface(ServletContextAware.class); beanFactory.ignoreDependencyInterface(ServletConfigAware.class); beanFactory.registerResolvableDependency(ServletContext.class, getServletContext()); beanFactory.registerResolvableDependency(ServletConfig.class, getServletConfig()); WebApplicationContextUtils.registerWebApplicationScopes(beanFactory); }