Class CoroutinesUtils

java.lang.Object
org.springframework.core.CoroutinesUtils

public abstract class CoroutinesUtils extends Object
Utilities for working with Kotlin Coroutines.
Since:
5.2
Author:
Sebastien Deleuze, Phillip Webb
  • Constructor Details

    • CoroutinesUtils

      public CoroutinesUtils()
  • Method Details

    • deferredToMono

      public static <T> reactor.core.publisher.Mono<T> deferredToMono(kotlinx.coroutines.Deferred<T> source)
      Convert a Deferred instance to a Mono.
    • monoToDeferred

      public static <T> kotlinx.coroutines.Deferred<T> monoToDeferred(reactor.core.publisher.Mono<T> source)
      Convert a Mono instance to a Deferred.
    • invokeSuspendingFunction

      public static Publisher<?> invokeSuspendingFunction(Method method, Object target, Object... args)
      Invoke a suspending function and converts it to Mono or Flux. Uses an unconfined dispatcher.
      Parameters:
      method - the suspending function to invoke
      target - the target to invoke method on
      args - the function arguments
      Returns:
      the method invocation result as reactive stream
    • invokeSuspendingFunction

      public static Publisher<?> invokeSuspendingFunction(kotlin.coroutines.CoroutineContext context, Method method, Object target, Object... args)
      Invoke a suspending function and converts it to Mono or Flux.
      Parameters:
      context - the coroutine context to use
      method - the suspending function to invoke
      target - the target to invoke method on
      args - the function arguments
      Returns:
      the method invocation result as reactive stream
      Since:
      6.0