Ignore nonexistent default-destroy-method in XML config
Prior to this commit, DisposableBeanAdapter attempted to invoke a configured default-destroy-method on every bean, including beans that do not declare the named destroy method, resulting in a NullPointerException being thrown and logged at WARN level. This commit addresses this by effectively ignoring any nonexistent destroy method. Closes gh-30301
This commit is contained in:
@@ -236,7 +236,9 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||
}
|
||||
else if (this.destroyMethods != null) {
|
||||
for (Method destroyMethod : this.destroyMethods) {
|
||||
invokeCustomDestroyMethod(destroyMethod);
|
||||
if (destroyMethod != null) {
|
||||
invokeCustomDestroyMethod(destroyMethod);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (this.destroyMethodNames != null) {
|
||||
|
||||
Reference in New Issue
Block a user