diff --git a/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java b/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
index 50d8043294..f6a23e2722 100644
--- a/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
+++ b/spring-core/src/main/java/org/springframework/core/ReactiveAdapterRegistry.java
@@ -16,6 +16,7 @@
package org.springframework.core;
+import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
@@ -24,9 +25,9 @@ import java.util.concurrent.CompletionStage;
import java.util.concurrent.Flow;
import java.util.function.Function;
-import kotlinx.coroutines.CompletableDeferredKt;
-import kotlinx.coroutines.Deferred;
import org.reactivestreams.Publisher;
+import org.reactivestreams.Subscriber;
+import org.reactivestreams.Subscription;
import reactor.adapter.JdkFlowAdapter;
import reactor.blockhound.BlockHound;
import reactor.blockhound.integration.BlockHoundIntegration;
@@ -36,15 +37,18 @@ import reactor.core.publisher.Mono;
import org.springframework.lang.Nullable;
import org.springframework.util.ClassUtils;
import org.springframework.util.ConcurrentReferenceHashMap;
+import org.springframework.util.ReflectionUtils;
/**
- * A registry of adapters to adapt Reactive Streams {@link Publisher} to/from
- * various async/reactive types such as {@code CompletableFuture}, RxJava
- * {@code Flowable}, and others.
+ * A registry of adapters to adapt Reactive Streams {@link Publisher} to/from various
+ * async/reactive types such as {@code CompletableFuture}, RxJava {@code Flowable}, etc.
+ * This is designed to complement Spring's Reactor {@code Mono}/{@code Flux} support while
+ * also being usable without Reactor, e.g. just for {@code org.reactivestreams} bridging.
*
- *
By default, depending on classpath availability, adapters are registered
- * for Reactor, RxJava 3, {@link CompletableFuture}, {@code Flow.Publisher},
- * and Kotlin Coroutines' {@code Deferred} and {@code Flow}.
+ *
By default, depending on classpath availability, adapters are registered for Reactor
+ * (including {@code CompletableFuture} and {@code Flow.Publisher} adapters), RxJava 3,
+ * Kotlin Coroutines' {@code Deferred} (bridged via Reactor) and SmallRye Mutiny 1.x/2.x.
+ * If Reactor is not present, a simple {@code Flow.Publisher} bridge will be registered.
*
* @author Rossen Stoyanchev
* @author Sebastien Deleuze
@@ -79,6 +83,7 @@ public class ReactiveAdapterRegistry {
* Create a registry and auto-register default adapters.
* @see #getSharedInstance()
*/
+ @SuppressWarnings("unchecked")
public ReactiveAdapterRegistry() {
// Reactor
if (reactorPresent) {
@@ -99,6 +104,14 @@ public class ReactiveAdapterRegistry {
if (mutinyPresent) {
new MutinyRegistrar().registerAdapters(this);
}
+
+ // Simple Flow.Publisher bridge if Reactor is not present
+ if (!reactorPresent) {
+ registerReactiveType(
+ ReactiveTypeDescriptor.multiValue(Flow.Publisher.class, () -> PublisherToRS.EMPTY_FLOW),
+ source -> new PublisherToRS<>((Flow.Publisher