Interface DisposableBean
- All Known Implementing Classes:
AbstractBeanFactoryBasedTargetSourceCreator
,AbstractEntityManagerFactoryBean
,AbstractFactoryBean
,AbstractJaxWsServiceExporter
,AbstractJmsListeningContainer
,AbstractMessageListenerContainer
,AbstractPollingMessageListenerContainer
,AbstractPoolingTargetSource
,AbstractRequestLoggingFilter
,AbstractServiceLoaderBasedFactoryBean
,AnnotationMBeanExporter
,BeanConfigurerSupport
,CachingConnectionFactory
,CharacterEncodingFilter
,CommonsPool2TargetSource
,CommonsRequestLoggingFilter
,ConnectorServerFactoryBean
,ContextLifecycleScheduledTaskRegistrar
,CorsFilter
,DataSourceInitializer
,DefaultContextLoadTimeWeaver
,DefaultMessageListenerContainer
,DelegatingFilterProxy
,EhCacheManagerFactoryBean
,EmbeddedDatabaseFactoryBean
,ExecutorConfigurationSupport
,ForkJoinPoolFactoryBean
,FormContentFilter
,ForwardedHeaderFilter
,GenericFilterBean
,GenericMessageEndpointManager
,HiddenHttpMethodFilter
,HttpComponentsAsyncClientHttpRequestFactory
,HttpComponentsClientHttpRequestFactory
,HttpPutFormContentFilter
,JCacheManagerFactoryBean
,JettyResourceFactory
,JmsListenerEndpointRegistry
,JmsMessageEndpointManager
,JndiRmiServiceExporter
,LazyInitTargetSourceCreator
,ListFactoryBean
,LocalContainerEntityManagerFactoryBean
,LocalEntityManagerFactoryBean
,LocalSessionFactoryBean
,LocalValidatorFactoryBean
,MapFactoryBean
,MBeanClientInterceptor
,MBeanExporter
,MBeanProxyFactoryBean
,MBeanServerConnectionFactoryBean
,MBeanServerFactoryBean
,MultipartFilter
,Netty4ClientHttpRequestFactory
,NotificationListenerRegistrar
,ObjectFactoryCreatingFactoryBean
,OkHttp3ClientHttpRequestFactory
,OncePerRequestFilter
,OpenEntityManagerInViewFilter
,OpenSessionInViewFilter
,OptionalValidatorFactoryBean
,ProviderCreatingFactoryBean
,QuickTargetSourceCreator
,ReactorResourceFactory
,RelativeRedirectFilter
,RequestContextFilter
,ResourceAdapterFactoryBean
,ResourceBundleViewResolver
,ResourceUrlEncodingFilter
,RmiRegistryFactoryBean
,RmiServiceExporter
,ScheduledAnnotationBeanPostProcessor
,ScheduledExecutorFactoryBean
,ScheduledTaskRegistrar
,SchedulerFactoryBean
,ScriptFactoryPostProcessor
,ServiceFactoryBean
,ServiceListFactoryBean
,ServiceLoaderFactoryBean
,ServletContextRequestLoggingFilter
,ServletContextScope
,ServletWrappingController
,SetFactoryBean
,ShallowEtagHeaderFilter
,SimpleHttpServerFactoryBean
,SimpleHttpServerJaxWsServiceExporter
,SimpleJaxWsServiceExporter
,SimpleMessageListenerContainer
,SimpleRemoteSlsbInvokerInterceptor
,SimpleRemoteStatelessSessionProxyFactoryBean
,SimpleThreadPoolTaskExecutor
,SingleConnectionDataSource
,SingleConnectionFactory
,SingleConnectionFactory
,SortedResourcesFactoryBean
,TaskExecutorFactoryBean
,ThreadLocalTargetSource
,ThreadPoolExecutorFactoryBean
,ThreadPoolTaskExecutor
,ThreadPoolTaskScheduler
,TilesConfigurer
,TimerManagerAccessor
,TimerManagerFactoryBean
,TimerManagerTaskScheduler
,XmlViewResolver
public interface DisposableBean
Interface to be implemented by beans that want to release resources on destruction. ABeanFactory
will invoke the destroy method on individual destruction of a scoped bean. AnApplicationContext
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 theBeanFactory javadocs
.- Since:
- 12.08.2003
- Author:
- Juergen Hoeller
- See Also:
InitializingBean
,AbstractBeanDefinition.getDestroyMethodName()
,ConfigurableBeanFactory.destroySingletons()
,ConfigurableApplicationContext.close()
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
destroy()
Invoked by the containingBeanFactory
on destruction of a bean.