Example usage for org.springframework.beans.factory.support DisposableBeanAdapter DisposableBeanAdapter

List of usage examples for org.springframework.beans.factory.support DisposableBeanAdapter DisposableBeanAdapter

Introduction

In this page you can find the example usage for org.springframework.beans.factory.support DisposableBeanAdapter DisposableBeanAdapter.

Prototype

private DisposableBeanAdapter(Object bean, String beanName, boolean invokeDisposableBean,
        boolean nonPublicAccessAllowed, @Nullable String destroyMethodName,
        @Nullable List<DestructionAwareBeanPostProcessor> postProcessors) 

Source Link

Document

Create a new DisposableBeanAdapter for the given bean.

Usage

From source file:org.springframework.beans.factory.support.DisposableBeanAdapter.java

/**
 * Serializes a copy of the state of this class,
 * filtering out non-serializable BeanPostProcessors.
 *///  www. j ava2 s  . c o  m
protected Object writeReplace() {
    List<DestructionAwareBeanPostProcessor> serializablePostProcessors = null;
    if (this.beanPostProcessors != null) {
        serializablePostProcessors = new ArrayList<>();
        for (DestructionAwareBeanPostProcessor postProcessor : this.beanPostProcessors) {
            if (postProcessor instanceof Serializable) {
                serializablePostProcessors.add(postProcessor);
            }
        }
    }
    return new DisposableBeanAdapter(this.bean, this.beanName, this.invokeDisposableBean,
            this.nonPublicAccessAllowed, this.destroyMethodName, serializablePostProcessors);
}