Skip init/destroy method check for null beans
Issue: SPR-16063
This commit is contained in:
@@ -1764,7 +1764,7 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
}
|
||||
}
|
||||
|
||||
if (mbd != null) {
|
||||
if (mbd != null && bean.getClass() != NullBean.class) {
|
||||
String initMethodName = mbd.getInitMethodName();
|
||||
if (StringUtils.hasLength(initMethodName) &&
|
||||
!(isInitializingBean && "afterPropertiesSet".equals(initMethodName)) &&
|
||||
|
||||
@@ -1662,8 +1662,8 @@ public abstract class AbstractBeanFactory extends FactoryBeanRegistrySupport imp
|
||||
* @see AbstractBeanDefinition#getDestroyMethodName()
|
||||
* @see org.springframework.beans.factory.config.DestructionAwareBeanPostProcessor
|
||||
*/
|
||||
protected boolean requiresDestruction(@Nullable Object bean, RootBeanDefinition mbd) {
|
||||
return (bean != null &&
|
||||
protected boolean requiresDestruction(Object bean, RootBeanDefinition mbd) {
|
||||
return (bean.getClass() != NullBean.class &&
|
||||
(DisposableBeanAdapter.hasDestroyMethod(bean, mbd) || (hasDestructionAwareBeanPostProcessors() &&
|
||||
DisposableBeanAdapter.hasApplicableProcessors(bean, getBeanPostProcessors()))));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user