The Spring Framework

org.springframework.beans.factory
Interface DisposableBean

All Known Implementing Classes:
AbstractApplicationContext, AbstractBeanFactoryBasedTargetSourceCreator, AbstractEntityManagerFactoryBean, AbstractFactoryBean, AbstractJmsListeningContainer, AbstractMessageListenerContainer, AbstractPollingMessageListenerContainer, AbstractPoolingTargetSource, AbstractRefreshableApplicationContext, AbstractRefreshablePortletApplicationContext, AbstractRefreshableWebApplicationContext, AbstractRequestLoggingFilter, AbstractSessionFactoryBean, AbstractXmlApplicationContext, AnnotationSessionFactoryBean, BeanConfigurerSupport, CharacterEncodingFilter, ClassPathXmlApplicationContext, CommonsPoolTargetSource, CommonsRequestLoggingFilter, ConnectorServerFactoryBean, DefaultMessageListenerContainer, DefaultMessageListenerContainer102, DelegatingFilterProxy, EhCacheManagerFactoryBean, FileSystemXmlApplicationContext, GenericApplicationContext, GenericFilterBean, GenericWebApplicationContext, JndiRmiServiceExporter, JotmFactoryBean, LazyInitTargetSourceCreator, ListFactoryBean, LocalContainerEntityManagerFactoryBean, LocalEntityManagerFactoryBean, LocalPersistenceManagerFactoryBean, LocalSessionFactoryBean, LocalSessionFactoryBean, LocalSessionFactoryBean, Log4jNestedDiagnosticContextFilter, MapFactoryBean, MBeanClientInterceptor, MBeanExporter, MBeanProxyFactoryBean, MBeanServerConnectionFactoryBean, MBeanServerFactoryBean, MultipartFilter, ObjectFactoryCreatingFactoryBean, OncePerRequestFilter, OpenEntityManagerInViewFilter, OpenPersistenceManagerInViewFilter, OpenSessionInViewFilter, OpenSessionInViewFilter, PortletWrappingController, QuickTargetSourceCreator, RequestContextFilter, ResourceAdapterFactoryBean, ResourceBundleViewResolver, RmiRegistryFactoryBean, RmiServiceExporter, ScheduledExecutorFactoryBean, ScheduledExecutorFactoryBean, SchedulerFactoryBean, ScriptFactoryPostProcessor, ServerSessionMessageListenerContainer, ServerSessionMessageListenerContainer102, ServletContextRequestLoggingFilter, ServletWrappingController, SetFactoryBean, SimpleMessageListenerContainer, SimpleMessageListenerContainer102, SimpleThreadPoolTaskExecutor, SingleConnectionDataSource, SingleConnectionFactory, SingleConnectionFactory, SingleConnectionFactory102, StaticApplicationContext, StaticPortletApplicationContext, StaticWebApplicationContext, ThreadLocalTargetSource, ThreadPoolTaskExecutor, ThreadPoolTaskExecutor, TimerFactoryBean, TimerManagerFactoryBean, TimerTaskExecutor, XmlPortletApplicationContext, XmlViewResolver, XmlWebApplicationContext

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:
AbstractBeanDefinition.getDestroyMethodName(), ConfigurableApplicationContext.close()

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

Method Detail

destroy

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

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

The Spring Framework

Copyright © 2002-2007 The Spring Framework.