BeanFactory will invoke the destroy method on individual destruction of a
scoped bean. An org.springframework.context.ApplicationContext is supposed
to dispose all of its singletons on shutdown, driven by the application lifecycle.
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.
InitializingBean, org.springframework.beans.factory.support.RootBeanDefinition#getDestroyMethodName() , org.springframework.beans.factory.config.ConfigurableBeanFactory#destroySingletons() , org.springframework.context.ConfigurableApplicationContext#close()
| Modifier and Type | Method and Description |
|---|---|
| public void |
| destroy | back to summary |
|---|---|
| public void destroy() throws Exception Invoked by the containing
| |