org.riotfamily.common.beans.config
Class WebApplicationContextBeanImporter

java.lang.Object
  extended by org.riotfamily.common.beans.config.WebApplicationContextBeanImporter
All Implemented Interfaces:
BeanNameAware, FactoryBean, InitializingBean, ServletContextAware

public class WebApplicationContextBeanImporter
extends Object
implements ServletContextAware, BeanNameAware, FactoryBean, InitializingBean

FactoryBean that imports a bean from another WebApplicationContext.

In order to work, the other context must be initialized before this bean is processed. You can control the initialization order via the <load-on-startup> tag in the web.xml descriptor.

Since:
7.0.1
Author:
Felix Gnass [fgnass at neteye dot de]

Constructor Summary
WebApplicationContextBeanImporter()
           
 
Method Summary
 void afterPropertiesSet()
           
 Object getObject()
           
 Class<?> getObjectType()
           
 boolean isSingleton()
           
 void setBeanName(String beanName)
          Sets the name of the bean to be imported.
 void setServletContext(ServletContext servletContext)
           
 void setServletName(String servletName)
          Sets the name of the DispatcherServlet from which the bean should be imported.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

WebApplicationContextBeanImporter

public WebApplicationContextBeanImporter()
Method Detail

setServletName

public void setServletName(String servletName)
Sets the name of the DispatcherServlet from which the bean should be imported.


setBeanName

public void setBeanName(String beanName)
Sets the name of the bean to be imported. If not specified, the name defaults to the local bean name.

Specified by:
setBeanName in interface BeanNameAware

setServletContext

public void setServletContext(ServletContext servletContext)
Specified by:
setServletContext in interface ServletContextAware

afterPropertiesSet

public void afterPropertiesSet()
                        throws Exception
Specified by:
afterPropertiesSet in interface InitializingBean
Throws:
Exception

getObject

public Object getObject()
                 throws Exception
Specified by:
getObject in interface FactoryBean
Throws:
Exception

getObjectType

public Class<?> getObjectType()
Specified by:
getObjectType in interface FactoryBean

isSingleton

public boolean isSingleton()
Specified by:
isSingleton in interface FactoryBean