Find destroy methods in superclass interfaces

Related tests will be added in
https://github.com/spring-projects/spring-aot-smoke-tests.

Closes gh-32006
This commit is contained in:
Sébastien Deleuze 2024-01-12 11:37:42 +01:00
parent ee04442be7
commit 5c77c3739e
1 changed files with 2 additions and 2 deletions

View File

@ -1,5 +1,5 @@
/* /*
* Copyright 2002-2023 the original author or authors. * Copyright 2002-2024 the original author or authors.
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License. * you may not use this file except in compliance with the License.
@ -272,7 +272,7 @@ class DisposableBeanAdapter implements DisposableBean, Runnable, Serializable {
if (destroyMethod != null) { if (destroyMethod != null) {
return destroyMethod; return destroyMethod;
} }
for (Class<?> beanInterface : beanClass.getInterfaces()) { for (Class<?> beanInterface : ClassUtils.getAllInterfacesForClass(beanClass)) {
destroyMethod = findDestroyMethod(beanInterface, methodName); destroyMethod = findDestroyMethod(beanInterface, methodName);
if (destroyMethod != null) { if (destroyMethod != null) {
return destroyMethod; return destroyMethod;