Interface DestructionAwareBeanPostProcessor
- All Superinterfaces:
- BeanPostProcessor
- All Known Implementing Classes:
- CommonAnnotationBeanPostProcessor, InitDestroyAnnotationBeanPostProcessor, PersistenceAnnotationBeanPostProcessor, ScheduledAnnotationBeanPostProcessor, SimpleServletPostProcessor
Subinterface of 
BeanPostProcessor that adds a before-destruction callback.
The typical usage will be to invoke custom destruction callbacks on specific bean types, matching corresponding initialization callbacks.
- Since:
- 1.0.1
- Author:
- Juergen Hoeller
- 
Method SummaryModifier and TypeMethodDescriptionvoidpostProcessBeforeDestruction(Object bean, String beanName) Apply this BeanPostProcessor to the given bean instance before its destruction, for example, invoking custom destruction callbacks.default booleanrequiresDestruction(Object bean) Determine whether the given bean instance requires destruction by this post-processor.Methods inherited from interface BeanPostProcessorpostProcessAfterInitialization, postProcessBeforeInitialization
- 
Method Details- 
postProcessBeforeDestructionApply this BeanPostProcessor to the given bean instance before its destruction, for example, invoking custom destruction callbacks.Like DisposableBean's destroyand a custom destroy method, this callback will only apply to beans which the container fully manages the lifecycle for. This is usually the case for singletons and scoped beans.- Parameters:
- bean- the bean instance to be destroyed
- beanName- the name of the bean
- Throws:
- BeansException- in case of errors
- See Also:
 
- 
requiresDestructionDetermine whether the given bean instance requires destruction by this post-processor.The default implementation returns true. If a pre-5 implementation ofDestructionAwareBeanPostProcessordoes not provide a concrete implementation of this method, Spring silently assumestrueas well.- Parameters:
- bean- the bean instance to check
- Returns:
- trueif- postProcessBeforeDestruction(Object, String)is supposed to be called for this bean instance eventually, or- falseif not needed
- Since:
- 4.3
 
 
-