spring-framework / org.springframework.beans.factory.config / DestructionAwareBeanPostProcessor / postProcessBeforeDestruction

postProcessBeforeDestruction

abstract fun postProcessBeforeDestruction(bean: Any, beanName: String): Unit

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

Exceptions

org.springframework.beans.BeansException - in case of errors

See Also
org.springframework.beans.factory.DisposableBeanorg.springframework.beans.factory.support.AbstractBeanDefinition#setDestroyMethodName