From 5a275443b54dbb0627f2bdd7c39bb4c164bc551a Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Tue, 28 May 2024 16:35:58 +0200 Subject: [PATCH] Apply ThreadLocal#remove() to pre-instantiation threads See gh-13410 See gh-32874 --- .../beans/factory/support/DefaultListableBeanFactory.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java index 384c2cbc49..6d8c27708b 100644 --- a/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java +++ b/spring-beans/src/main/java/org/springframework/beans/factory/support/DefaultListableBeanFactory.java @@ -1030,7 +1030,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto } } finally { - this.preInstantiationThread.set(null); + this.preInstantiationThread.remove(); } if (!futures.isEmpty()) { try { @@ -1100,7 +1100,7 @@ public class DefaultListableBeanFactory extends AbstractAutowireCapableBeanFacto throw ex; } finally { - this.preInstantiationThread.set(null); + this.preInstantiationThread.remove(); } }