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();