com.interface21.beans.factory
Interface Lifecycle

All Known Implementing Classes:
ProxyFactoryBean, LocalStatelessSessionProxyFactoryBean, SimpleRemoteStatelessSessionProxyFactoryBean

public interface Lifecycle

Interface to be implemented by beans that wish to be notified of lifecycle events by their owning BeanFactory. Also provides a way that beans can obtain a reference their owning BeanFactory, which they can use to look up collaborating beans.

Since:
11-Mar-2003
Version:
$Revision: 1.1 $
Author:
Rod Johnson

Method Summary
 void setBeanFactory(BeanFactory beanFactory)
          Lifecycle callback beans used in a BeanFactory can implement to receive callbacks exposing the factory itself.
 

Method Detail

setBeanFactory

public void setBeanFactory(BeanFactory beanFactory)
                    throws java.lang.Exception
Lifecycle callback beans used in a BeanFactory can implement to receive callbacks exposing the factory itself. This enables them to obtain other beans from the factory.
If the bean also implements InitializingBean, Lifecycle methods will be invoked after the afterPropertiesSet method.
Parameters:
beanFactory - owning BeanFactory. May not be null. The bean can immediately call methods on the factory.
Throws:
java.lang.Exception - this method can throw any exception. Normally we want methods to declare more precise exceptions, but in this case the owning BeanFactory will catch and handle the exception (treating it as fatal), and we want to make it easy to implement Lifecycle beans by freeing developers from the need to catch and wrap fatal exceptions. Exceptions thrown here are considered fatal.


Rod Johnson and Spring contributors 2001-2003.