Polishing
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -48,8 +48,8 @@ public interface BeanPostProcessor {
|
||||
* The returned bean instance may be a wrapper around the original.
|
||||
* @param bean the new bean instance
|
||||
* @param beanName the name of the bean
|
||||
* @return the bean instance to use, either the original or a wrapped one; if
|
||||
* {@code null}, no subsequent BeanPostProcessors will be invoked
|
||||
* @return the bean instance to use, either the original or a wrapped one;
|
||||
* if {@code null}, no subsequent BeanPostProcessors will be invoked
|
||||
* @throws org.springframework.beans.BeansException in case of errors
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet
|
||||
*/
|
||||
@@ -69,8 +69,8 @@ public interface BeanPostProcessor {
|
||||
* in contrast to all other BeanPostProcessor callbacks.
|
||||
* @param bean the new bean instance
|
||||
* @param beanName the name of the bean
|
||||
* @return the bean instance to use, either the original or a wrapped one; if
|
||||
* {@code null}, no subsequent BeanPostProcessors will be invoked
|
||||
* @return the bean instance to use, either the original or a wrapped one;
|
||||
* if {@code null}, no subsequent BeanPostProcessors will be invoked
|
||||
* @throws org.springframework.beans.BeansException in case of errors
|
||||
* @see org.springframework.beans.factory.InitializingBean#afterPropertiesSet
|
||||
* @see org.springframework.beans.factory.FactoryBean
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -37,11 +37,12 @@ import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.ReflectionUtils;
|
||||
|
||||
/**
|
||||
* Adapter that implements the {@link DisposableBean} and {@link Runnable} interfaces
|
||||
* performing various destruction steps on a given bean instance:
|
||||
* Adapter that implements the {@link DisposableBean} and {@link Runnable}
|
||||
* interfaces performing various destruction steps on a given bean instance:
|
||||
* <ul>
|
||||
* <li>DestructionAwareBeanPostProcessors;
|
||||
* <li>the bean implementing DisposableBean itself;
|
||||
@@ -175,8 +176,8 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
/**
|
||||
* If the current value of the given beanDefinition's "destroyMethodName" property is
|
||||
* {@link AbstractBeanDefinition#INFER_METHOD}, then attempt to infer a destroy method.
|
||||
* Candidate methods are currently limited to public, no-arg methods named "close"
|
||||
* (whether declared locally or inherited). The given BeanDefinition's
|
||||
* Candidate methods are currently limited to public, no-arg methods named "close" or
|
||||
* "shutdown" (whether declared locally or inherited). The given BeanDefinition's
|
||||
* "destroyMethodName" is updated to be null if no such method is found, otherwise set
|
||||
* to the name of the inferred method. This constant serves as the default for the
|
||||
* {@code @Bean#destroyMethod} attribute and the value of the constant may also be
|
||||
@@ -215,7 +216,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
*/
|
||||
private List<DestructionAwareBeanPostProcessor> filterPostProcessors(List<BeanPostProcessor> postProcessors) {
|
||||
List<DestructionAwareBeanPostProcessor> filteredPostProcessors = null;
|
||||
if (postProcessors != null && !postProcessors.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(postProcessors)) {
|
||||
filteredPostProcessors = new ArrayList<DestructionAwareBeanPostProcessor>(postProcessors.size());
|
||||
for (BeanPostProcessor postProcessor : postProcessors) {
|
||||
if (postProcessor instanceof DestructionAwareBeanPostProcessor) {
|
||||
@@ -234,7 +235,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
if (this.beanPostProcessors != null && !this.beanPostProcessors.isEmpty()) {
|
||||
if (!CollectionUtils.isEmpty(this.beanPostProcessors)) {
|
||||
for (DestructionAwareBeanPostProcessor processor : this.beanPostProcessors) {
|
||||
processor.postProcessBeforeDestruction(this.bean, this.beanName);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user