org.springframework.beans.factory
Interface DisposableBean

All Known Implementing Classes:
AbstractPoolingTargetSource, JotmFactoryBean, LocalPersistenceManagerFactoryBean, LocalSessionFactoryBean, ResourceBundleViewResolver, RmiServiceExporter, SchedulerFactoryBean, SingleConnectionDataSource, ThreadLocalTargetSource, TimerFactoryBean, XmlViewResolver

public interface DisposableBean

Interface to be implemented by beans that want to release resources on destruction. A BeanFactory is supposed to invoke the destroy method if it disposes a cached singleton. An application context is supposed to dispose all of its singletons on close.

An alternative to implementing DisposableBean is specifying a custom destroy-method, for example in an XML bean definition. For a list of all bean lifecycle methods, see the BeanFactory javadocs.

Since:
12.08.2003
Author:
Juergen Hoeller
See Also:
RootBeanDefinition.getDestroyMethodName(), ConfigurableApplicationContext.close()

Method Summary
 void destroy()
          Invoked by a BeanFactory on destruction of a singleton.
 

Method Detail

destroy

public void destroy()
             throws java.lang.Exception
Invoked by a BeanFactory on destruction of a singleton.

Throws:
java.lang.Exception - in case of shutdown errors. Exceptions will get logged but not rethrown to allow other beans to release their resources too.


Copyright (C) 2003-2004 The Spring Framework Project.