Package org.springframework.core
Class CoroutinesUtils
java.lang.Object
org.springframework.core.CoroutinesUtils
Utilities for working with Kotlin Coroutines.
- Since:
- 5.2
- Author:
- Sebastien Deleuze, Phillip Webb
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionstatic <T> reactor.core.publisher.Mono<T>deferredToMono(kotlinx.coroutines.Deferred<T> source) Convert aDeferredinstance to aMono.static Publisher<?>invokeSuspendingFunction(Method method, Object target, Object... args) Invoke a suspending function and convert it toMonoorFlux.static Publisher<?>invokeSuspendingFunction(kotlin.coroutines.CoroutineContext context, Method method, Object target, Object... args) Invoke a suspending function and convert it toMonoorFlux.static <T> kotlinx.coroutines.Deferred<T>monoToDeferred(reactor.core.publisher.Mono<T> source) Convert aMonoinstance to aDeferred.
- 
Constructor Details- 
CoroutinesUtilspublic CoroutinesUtils()
 
- 
- 
Method Details- 
deferredToMonopublic static <T> reactor.core.publisher.Mono<T> deferredToMono(kotlinx.coroutines.Deferred<T> source) Convert aDeferredinstance to aMono.
- 
monoToDeferredpublic static <T> kotlinx.coroutines.Deferred<T> monoToDeferred(reactor.core.publisher.Mono<T> source) Convert aMonoinstance to aDeferred.
- 
invokeSuspendingFunctionInvoke a suspending function and convert it toMonoorFlux. Uses an unconfined dispatcher.- Parameters:
- method- the suspending function to invoke
- target- the target to invoke- methodon
- args- the function arguments. If the- Continuationargument is specified as the last argument (typically- null), it is ignored.
- Returns:
- the method invocation result as reactive stream
- Throws:
- IllegalArgumentException- if- methodis not a suspending function
 
- 
invokeSuspendingFunctionpublic static Publisher<?> invokeSuspendingFunction(kotlin.coroutines.CoroutineContext context, Method method, Object target, Object... args) Invoke a suspending function and convert it toMonoorFlux.- Parameters:
- context- the coroutine context to use
- method- the suspending function to invoke
- target- the target to invoke- methodon
- args- the function arguments. If the- Continuationargument is specified as the last argument (typically- null), it is ignored.
- Returns:
- the method invocation result as reactive stream
- Throws:
- IllegalArgumentException- if- methodis not a suspending function
- Since:
- 6.0
 
 
-