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

requiresDestruction

open fun requiresDestruction(bean: Any): Boolean

Determine whether the given bean instance requires destruction by this post-processor.

NOTE: Even as a late addition, this method has been introduced on DestructionAwareBeanPostProcessor itself instead of on a SmartDABPP subinterface. This allows existing DestructionAwareBeanPostProcessor implementations to easily provide requiresDestruction logic while retaining compatibility with Spring <4.3, and it is also an easier onramp to declaring requiresDestruction as a Java 8 default method in Spring 5.

If an implementation of DestructionAwareBeanPostProcessor does not provide a concrete implementation of this method, Spring's invocation mechanism silently assumes a method returning true (the effective default before 4.3, and the to-be-default in the Java 8 method in Spring 5).

Parameters

bean - the bean instance to check

Return
true if #postProcessBeforeDestruction is supposed to be called for this bean instance eventually, or false if not needed

Since
4.3