From fc9c1c09647b2eb5053513d547845ea264f544f9 Mon Sep 17 00:00:00 2001 From: Moritz Halbritter Date: Wed, 4 Oct 2023 10:59:34 +0200 Subject: [PATCH] Fix ordering related issue in ReactorAutoConfigurationTests See gh-34201 --- .../reactor/ReactorAutoConfigurationTests.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java index 32897e1b3a..1587fc2050 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java +++ b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/reactor/ReactorAutoConfigurationTests.java @@ -20,8 +20,11 @@ import java.util.concurrent.atomic.AtomicReference; import io.micrometer.context.ContextRegistry; import org.junit.jupiter.api.AfterAll; +import org.junit.jupiter.api.AfterEach; import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; +import reactor.core.publisher.Hooks; import reactor.core.publisher.Mono; import reactor.util.context.Context; @@ -45,6 +48,12 @@ class ReactorAutoConfigurationTests { private static final ThreadLocal THREADLOCAL_VALUE = ThreadLocal.withInitial(() -> "initial"); + @BeforeEach + @AfterEach + void resetStaticState() { + Hooks.disableAutomaticContextPropagation(); + } + @BeforeAll static void initializeThreadLocalAccessors() { ContextRegistry globalRegistry = ContextRegistry.getInstance();