Interface DisposableBean
- All Known Implementing Classes:
AbstractFactoryBean,AbstractServiceLoaderBasedFactoryBean,BeanConfigurerSupport,ListFactoryBean,MapFactoryBean,ObjectFactoryCreatingFactoryBean,ProviderCreatingFactoryBean,ServiceFactoryBean,ServiceListFactoryBean,ServiceLoaderFactoryBean,SetFactoryBean
public interface DisposableBean
Interface to be implemented by beans that want to release resources on destruction.
A
is supposed
to dispose all of its singletons on shutdown, driven by the application lifecycle.
BeanFactory will invoke the destroy method on individual destruction of a
scoped bean. An
invalid reference
org.springframework.context.ApplicationContext
A Spring-managed bean may also implement Java's AutoCloseable interface
for the same purpose. An alternative to implementing an interface 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:
-
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()Invoked by the containingBeanFactoryon destruction of a bean.
-
Method Details
-
destroy
-