From 5c77c3739ea2eaf292639a702f721c0b5a73a277 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=A9bastien=20Deleuze?= Date: Fri, 12 Jan 2024 11:37:42 +0100 Subject: [PATCH] Find destroy methods in superclass interfaces Related tests will be added in https://github.com/spring-projects/spring-aot-smoke-tests. Closes gh-32006 --- .../beans/factory/support/DisposableBeanAdapter.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java index ea07ba7bcbc..35ca8470e2b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DisposableBeanAdapter.java @@ -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"); * 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) { return destroyMethod; } - for (Class beanInterface : beanClass.getInterfaces()) { + for (Class beanInterface : ClassUtils.getAllInterfacesForClass(beanClass)) { destroyMethod = findDestroyMethod(beanInterface, methodName); if (destroyMethod != null) { return destroyMethod;