-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Update to Micronaut 2.0.0 breaks injection of DefaultSecurityService in background tasks #3868
Comments
What is error you are getting..? if its circular dependency related then pls see below .. #3239 |
@someshrathi02 No error, but |
@someshrathi02 I edited the original post with a project to reproduce the issue. |
Thanks foe updates. so its different issue than one which i faced while upgrading micronaut version |
@oscarfh Can you use RxJava2's instead of |
@dstepanov yes, I did and it worked. Nevertheless, in my opinion, the fact that the context was passed to the new thread and now it is not anymore is an important behavior change that should, at least, be documented. |
we probably need a way to handle this use case although I believe We may be able to support the use case whereby |
Actually changing the example to
It correctly injects an instrumented Executor and context is preserved. @graemerocher Looking at this commit 928a2ba should it be |
@oscarfh I think this can be closed, the problem you have that without a name you are injecting "random" |
@dstepanov interesting that Micronaut is injecting a random, it should fail with a multiple bean definition exception without |
@dstepanov @graemerocher If you feel it is more appropriate, feel free to close. |
Hi,
I am migrating a project from Micronaut 1.x to 2.0 and I am facing a behavior that was changed and I am wondering whether this is something I can configure and that I should change entirely.
My code is something like this (simplified version)
The problem is that I have a filter down the chain that uses
defaultSecurityService.getAuthentication();
. In 1.x, I was able to get the user's authentication and create a token for it. Now I can't and my request is made without token and fails.My filter
Question:
Can I propagate the user context to the new thread, so my filter works as before?
(I need the security service in my filter, I added it to the check method in order to verify whether the behavior was due to the async thread or some change on the filter).
Clarifications:
Steps to Reproduce:
Checkout this commit in this repository and Run the com.example.DemoTest#testHello test. You will be able to see to following output in your logs:
Which indicates that the context was inherited by the backgroup thread.
Then check out this commit, clean and **rebuild ** and you will see the following output:
Indicating that the context is not propagated anymore.
The text was updated successfully, but these errors were encountered: