diff --git a/module/spring-boot-reactor/src/main/java/org/springframework/boot/reactor/ReactorEnvironmentPostProcessor.java b/module/spring-boot-reactor/src/main/java/org/springframework/boot/reactor/ReactorEnvironmentPostProcessor.java index 41110ccddf5..210b0627543 100644 --- a/module/spring-boot-reactor/src/main/java/org/springframework/boot/reactor/ReactorEnvironmentPostProcessor.java +++ b/module/spring-boot-reactor/src/main/java/org/springframework/boot/reactor/ReactorEnvironmentPostProcessor.java @@ -18,7 +18,7 @@ package org.springframework.boot.reactor; import org.springframework.boot.SpringApplication; import org.springframework.boot.env.EnvironmentPostProcessor; -import org.springframework.boot.system.JavaVersion; +import org.springframework.boot.thread.Threading; import org.springframework.core.Ordered; import org.springframework.core.env.ConfigurableEnvironment; import org.springframework.util.ClassUtils; @@ -56,8 +56,7 @@ public class ReactorEnvironmentPostProcessor implements EnvironmentPostProcessor } } } - if (environment.getProperty("spring.threads.virtual.enabled", boolean.class, false) - && JavaVersion.getJavaVersion().isEqualOrNewerThan(JavaVersion.TWENTY_ONE)) { + if (Threading.VIRTUAL.isActive(environment)) { System.setProperty("reactor.schedulers.defaultBoundedElasticOnVirtualThreads", "true"); } }