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:
parent
b5b115e52c
commit
c811428512
|
@ -236,7 +236,9 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
|
||||||
}
|
}
|
||||||
else if (this.destroyMethods != null) {
|
else if (this.destroyMethods != null) {
|
||||||
for (Method destroyMethod : this.destroyMethods) {
|
for (Method destroyMethod : this.destroyMethods) {
|
||||||
invokeCustomDestroyMethod(destroyMethod);
|
if (destroyMethod != null) {
|
||||||
|
invokeCustomDestroyMethod(destroyMethod);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (this.destroyMethodNames != null) {
|
else if (this.destroyMethodNames != null) {
|
||||||
|
|
Loading…
Reference in New Issue