Consistent overriding for all variants of init/destroy method inheritance
Issue: SPR-15532
This commit is contained in:
@@ -1764,7 +1764,8 @@ public abstract class AbstractAutowireCapableBeanFactory extends AbstractBeanFac
|
||||
|
||||
if (mbd != null) {
|
||||
String initMethodName = mbd.getInitMethodName();
|
||||
if (initMethodName != null && !(isInitializingBean && "afterPropertiesSet".equals(initMethodName)) &&
|
||||
if (StringUtils.hasLength(initMethodName) &&
|
||||
!(isInitializingBean && "afterPropertiesSet".equals(initMethodName)) &&
|
||||
!mbd.isExternallyManagedInitMethod(initMethodName)) {
|
||||
invokeCustomInitMethod(beanName, bean, mbd);
|
||||
}
|
||||
|
||||
@@ -315,7 +315,7 @@ public abstract class AbstractBeanDefinition extends BeanMetadataAttributeAccess
|
||||
setNonPublicAccessAllowed(otherAbd.isNonPublicAccessAllowed());
|
||||
setLenientConstructorResolution(otherAbd.isLenientConstructorResolution());
|
||||
getMethodOverrides().addOverrides(otherAbd.getMethodOverrides());
|
||||
if (StringUtils.hasLength(otherAbd.getInitMethodName())) {
|
||||
if (otherAbd.getInitMethodName() != null) {
|
||||
setInitMethodName(otherAbd.getInitMethodName());
|
||||
setEnforceInitMethod(otherAbd.isEnforceInitMethod());
|
||||
}
|
||||
|
||||
@@ -110,12 +110,6 @@ public class BeanDefinitionParserDelegate {
|
||||
|
||||
public static final String AUTOWIRE_AUTODETECT_VALUE = "autodetect";
|
||||
|
||||
public static final String DEPENDENCY_CHECK_ALL_ATTRIBUTE_VALUE = "all";
|
||||
|
||||
public static final String DEPENDENCY_CHECK_SIMPLE_ATTRIBUTE_VALUE = "simple";
|
||||
|
||||
public static final String DEPENDENCY_CHECK_OBJECTS_ATTRIBUTE_VALUE = "objects";
|
||||
|
||||
public static final String NAME_ATTRIBUTE = "name";
|
||||
|
||||
public static final String BEAN_ELEMENT = "bean";
|
||||
@@ -609,9 +603,7 @@ public class BeanDefinitionParserDelegate {
|
||||
|
||||
if (ele.hasAttribute(INIT_METHOD_ATTRIBUTE)) {
|
||||
String initMethodName = ele.getAttribute(INIT_METHOD_ATTRIBUTE);
|
||||
if (!"".equals(initMethodName)) {
|
||||
bd.setInitMethodName(initMethodName);
|
||||
}
|
||||
bd.setInitMethodName(initMethodName);
|
||||
}
|
||||
else if (this.defaults.getInitMethod() != null) {
|
||||
bd.setInitMethodName(this.defaults.getInitMethod());
|
||||
|
||||
Reference in New Issue
Block a user