Hello, we want to keep mono context in coroutine scope For example: we use webFilter and set something to Context(reactor.util.context)

...
filter(exchange: ServerWebExchange, chain: WebFilterChain): Mono<Void> {
      context.put(ourCoroutineContext, "test")
...
}
...

And when we use such methods in controller:

suspend fun test():Response<Entity> {
       val test = coroutineContext[ourCoroutineContext]
}

test will be null. I think, it would be good to convert mono Context to coroutine Context, before invoke function. I see a part of code in InvocableHandlerMethod

ReflectionUtils.makeAccessible(getBridgedMethod());
                Method method = getBridgedMethod();
                if (KotlinDetector.isKotlinReflectPresent() && KotlinDetector.isKotlinType(method.getDeclaringClass())) {
                    value = CoroutinesUtils.invokeSuspendingFunction(method, getBean(), args);
                }

It would be good to extend invokeSuspend fun to take a mono Context, which will be transformed. What do you think? Also I would like to submit a PR, but I can't find what CoroutineUtils is.

Comment From: sdeleuze

CoroutineUtils is here https://github.com/spring-projects/spring-framework/blob/master/spring-core/kotlin-coroutines/src/main/kotlin/org/springframework/core/CoroutinesUtils.kt, feel free to provide a PR I will have a look asap.

Comment From: kostya05983

@sdeleuze , thanks, I will try.

Comment From: kostya05983

Hi, @sdeleuze ,you can review it.

Comment From: kostya05983

@sdeleuze

Comment From: rstoyanchev

Superseded by #23931.