List of usage examples for org.springframework.beans.factory.config DestructionAwareBeanPostProcessor requiresDestruction
default boolean requiresDestruction(Object bean)
From source file:org.springframework.beans.factory.support.DisposableBeanAdapter.java
/** * Search for all DestructionAwareBeanPostProcessors in the List. * @param processors the List to search//from w ww . ja v a 2 s .c om * @return the filtered List of DestructionAwareBeanPostProcessors */ @Nullable private List<DestructionAwareBeanPostProcessor> filterPostProcessors(List<BeanPostProcessor> processors, Object bean) { List<DestructionAwareBeanPostProcessor> filteredPostProcessors = null; if (!CollectionUtils.isEmpty(processors)) { filteredPostProcessors = new ArrayList<>(processors.size()); for (BeanPostProcessor processor : processors) { if (processor instanceof DestructionAwareBeanPostProcessor) { DestructionAwareBeanPostProcessor dabpp = (DestructionAwareBeanPostProcessor) processor; if (dabpp.requiresDestruction(bean)) { filteredPostProcessors.add(dabpp); } } } } return filteredPostProcessors; }
From source file:org.springframework.beans.factory.support.DisposableBeanAdapter.java
/** * Check whether the given bean has destruction-aware post-processors applying to it. * @param bean the bean instance/*from www. j a v a2 s.c om*/ * @param postProcessors the post-processor candidates */ public static boolean hasApplicableProcessors(Object bean, List<BeanPostProcessor> postProcessors) { if (!CollectionUtils.isEmpty(postProcessors)) { for (BeanPostProcessor processor : postProcessors) { if (processor instanceof DestructionAwareBeanPostProcessor) { DestructionAwareBeanPostProcessor dabpp = (DestructionAwareBeanPostProcessor) processor; if (dabpp.requiresDestruction(bean)) { return true; } } } } return false; }