diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java index 291ee055b1e7..99bb7d55fd90 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/AbstractBeanDefinition.java @@ -896,16 +896,20 @@ public String getInitMethodName() { } /** - * Specify whether or not the configured init method is the default. - *

The default value is {@code false}. + * Specify whether or not the configured initializer method is the default. + *

The default value is {@code true} for a locally specified init method + * but switched to {@code false} for a shared setting in a defaults section + * (e.g. {@code bean init-method} versus {@code beans default-init-method} + * level in XML) which might not apply to all contained bean definitions. * @see #setInitMethodName + * @see #applyDefaults */ public void setEnforceInitMethod(boolean enforceInitMethod) { this.enforceInitMethod = enforceInitMethod; } /** - * Indicate whether the configured init method is the default. + * Indicate whether the configured initializer method is the default. * @see #getInitMethodName() */ public boolean isEnforceInitMethod() { @@ -930,8 +934,12 @@ public String getDestroyMethodName() { /** * Specify whether or not the configured destroy method is the default. - *

The default value is {@code false}. + *

The default value is {@code true} for a locally specified destroy method + * but switched to {@code false} for a shared setting in a defaults section + * (e.g. {@code bean destroy-method} versus {@code beans default-destroy-method} + * level in XML) which might not apply to all contained bean definitions. * @see #setDestroyMethodName + * @see #applyDefaults */ public void setEnforceDestroyMethod(boolean enforceDestroyMethod) { this.enforceDestroyMethod = enforceDestroyMethod; @@ -939,7 +947,7 @@ public void setEnforceDestroyMethod(boolean enforceDestroyMethod) { /** * Indicate whether the configured destroy method is the default. - * @see #getDestroyMethodName + * @see #getDestroyMethodName() */ public boolean isEnforceDestroyMethod() { return this.enforceDestroyMethod; diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java index 19bc13b72c30..1964a4f453eb 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/BeanDefinitionDefaults.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2019 the original author or authors. + * Copyright 2002-2020 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. @@ -25,6 +25,7 @@ * @author Mark Fisher * @author Juergen Hoeller * @since 2.5 + * @see AbstractBeanDefinition#applyDefaults */ public class BeanDefinitionDefaults { @@ -45,6 +46,7 @@ public class BeanDefinitionDefaults { * Set whether beans should be lazily initialized by default. *

If {@code false}, the bean will get instantiated on startup by bean * factories that perform eager initialization of singletons. + * @see AbstractBeanDefinition#setLazyInit */ public void setLazyInit(boolean lazyInit) { this.lazyInit = lazyInit; @@ -66,6 +68,7 @@ public boolean isLazyInit() { * (however, there may still be explicit annotation-driven autowiring). * @param autowireMode the autowire mode to set. * Must be one of the constants defined in {@link AbstractBeanDefinition}. + * @see AbstractBeanDefinition#setAutowireMode */ public void setAutowireMode(int autowireMode) { this.autowireMode = autowireMode; @@ -82,6 +85,7 @@ public int getAutowireMode() { * Set the dependency check code. * @param dependencyCheck the code to set. * Must be one of the constants defined in {@link AbstractBeanDefinition}. + * @see AbstractBeanDefinition#setDependencyCheck */ public void setDependencyCheck(int dependencyCheck) { this.dependencyCheck = dependencyCheck; @@ -96,6 +100,10 @@ public int getDependencyCheck() { /** * Set the name of the default initializer method. + *

Note that this method is not enforced on all affected bean definitions + * but rather taken as an optional callback, to be invoked if actually present. + * @see AbstractBeanDefinition#setInitMethodName + * @see AbstractBeanDefinition#setEnforceInitMethod */ public void setInitMethodName(@Nullable String initMethodName) { this.initMethodName = (StringUtils.hasText(initMethodName) ? initMethodName : null); @@ -111,6 +119,10 @@ public String getInitMethodName() { /** * Set the name of the default destroy method. + *

Note that this method is not enforced on all affected bean definitions + * but rather taken as an optional callback, to be invoked if actually present. + * @see AbstractBeanDefinition#setDestroyMethodName + * @see AbstractBeanDefinition#setEnforceDestroyMethod */ public void setDestroyMethodName(@Nullable String destroyMethodName) { this.destroyMethodName = (StringUtils.hasText(destroyMethodName) ? destroyMethodName : null);