-
Notifications
You must be signed in to change notification settings - Fork 5.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make EnableReactiveMethodSecurity compatible with Kotlin Coroutines #8143
Comments
Could you please provide a complete sample? |
Upon making a request, curl -X POST -v -u admin:qwerty localhost:8080/api/test -d "xzcvxzcv" an exception is thrown: {
"timestamp": "2020-03-18T19:57:41.277+0000",
"path": "/api/test",
"status": 500,
"error": "Internal Server Error",
"message": "The returnType class java.lang.Object on public java.lang.Object com.example.demo.handlers.TestHandler.test(org.springframework.web.reactive.function.server.ServerRequest,kotlin.coroutines.Continuation) must return an instance of org.reactivestreams.Publisher (i.e. Mono / Flux) in order to support Reactor Context",
"requestId": "38010f7a-4"
} Complete stacktrace:
|
Thanks for the detailed sample. I don't think this can work at the moment because the @simonbasle Can you comment if Reactor's Context works with (or could work with) Kotlin Coroutines? |
IIRC Kotlin Coroutines' have their own concept of context which can be bridged over to Reactor's |
Interop between coroutine context and Reactor context should be possible according to this issue Kotlin/kotlinx.coroutines#284 |
Thanks for the additional details @simonbasle and @TonCherAmi We will look into this one once spring-projects/spring-framework#22462 is addressed. |
Indeed we still need to complete the Coroutines story with AOP and annotation based security and transaction support. @rwinch I will synchronize with you asap we make progress on this issue. |
@rwinch @eleftherias I have just merged Notice that Coroutines and Reactor conversion is context aware so this is automatically handled, and that you should probably use I don't think updates on Spring AOP side are needed. |
can still confirm the issue in the spring boot 2.4.1 |
Is there a way we can workaround this by implementing our own |
It didn't really work out, did it? For me the same exception. |
Has anyone found a workaround for this? |
Try to remove "suspend" from your endpoint function. mono{} starts new corotine |
Current implementation of
PrePostAdviceReactiveMethodInterceptor
makes it impossible to use@Pre/PostAuthorize
with suspending functions:This may be related to spring-projects/spring-framework#22462
Spring boot version:
2.2.1.RELEASE
The text was updated successfully, but these errors were encountered: