## org.springframework.beans.factory.config
Interface DestructionAwareBeanPostProcessor

All Superinterfaces:
  BeanPostProcessor

All Known Implementing Classes:
  CommonAnnotationBeanPostProcessor, InitDestroyAnnotationBeanPostProcessor, PersistenceAnnotationBeanPostProcessor, SimplePortletPostProcessor, SimpleServletPostProcessor

    public interface DestructionAwareBeanPostProcessor

extends BeanPostProcessor

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 Summary
`void` `postProcessBeforeDestruction(Object bean, String beanName)` Apply this BeanPostProcessor to the given bean instance before its destruction.

Methods inherited from interface org.springframework.beans.factory.config.BeanPostProcessor
`postProcessAfterInitialization, postProcessBeforeInitialization`

Method Detail

### postProcessBeforeDestruction

    void postProcessBeforeDestruction(Object bean,
                                      String beanName)
                                      throws BeansException

  Apply this BeanPostProcessor to the given bean instance before its destruction. Can invoke custom destruction callbacks.

  Like DisposableBean's `destroy` and a custom destroy method, this callback just applies to singleton beans in the factory (including inner beans).

  Parameters:
    `bean` - the bean instance to be destroyed
    `beanName` - the name of the bean
  Throws:
    `BeansException` - in case of errors
  See Also:
    `DisposableBean`, `AbstractBeanDefinition.setDestroyMethodName(java.lang.String)`