-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
RequestScoped beans keeping property values from previous requests when using kotlin. #10290
Comments
/cc @mkouba @evanchooly |
It's very likely that you get/set the values from the client proxy and not the real bean instance. I'm no kotlin expert but I thought that kotlin generates getters/setters for properties automatically, i.e. |
Sounds reasonable @mkouba although I don't know exactly why that would be happening - we would need to look at the bytecode. @evanchooly do you plan to look at this or should I check it out when I have some time? |
I can dig in to it but wouldn't be bothered if you got there first. I have a bit of a back log but I'm about to take a big one off that list. |
I'll see if I can squeze it in sometime next week. I'll update here in any case. |
When doing some more tests, I validated that when injecting a bean interface instead of the implementation, the problem does not seem to occur. |
Hi there. Im new here, and use your wonderfull software. I can verify the same problem also happens with @SessionScoped. @leandrobortoli , may I ask, how do you inject a bean interface, instead of implementation? |
I am pretty sure I can come up with a fix for this one. Will let you know by tomorrow. @mkouba this essentially comes down to us removing the |
This is done in the same manner that is already present for interceptors and is very useful for Kotlin code where methods are final by default Fixes: quarkusio#10290
#10497 takes care of the issue (I tested it with the reproducer and it now works as expected) |
This is done in the same manner that is already present for interceptors and is very useful for Kotlin code where methods are final by default Fixes: quarkusio#10290
This is done in the same manner that is already present for interceptors and is very useful for Kotlin code where methods are final by default Fixes: quarkusio#10290
This is done in the same manner that is already present for interceptors and is very useful for Kotlin code where methods are final by default Fixes: quarkusio#10290
This is done in the same manner that is already present for interceptors and is very useful for Kotlin code where methods are final by default Fixes: quarkusio#10290
This is done in the same manner that is already present for interceptors and is very useful for Kotlin code where methods are final by default Fixes: quarkusio#10290
Allow Arc to deal with final methods of beans that need to be proxied
Describe the bug
When using kotlin and injecting a RequestScoped bean, on each new request a new bean instance is initialized, but for some reason, the property values from the previous request bean are kept, this seems to be an issue only with the kotlin extension, because I couldn't reproduce the issue using Java.
Expected behavior
The new request bean should not contain previous property values
Actual behavior
A new bean instance is created on each request, but the same property values from previous requests are propagated.
To Reproduce
I've created a project to reproduce the issue here: https://github.com/leandrobortoli/quarkus-issue-request-scoped
On each request, it checks if the bean property has been initialized and if not initializes it with a random value, as a result, we can see that only the first request initializes the properties and the values are propagated in the subsequent requests.
Screenshots
OUTPUT WITH 3 CONSECUTIVE REQUESTS:
Environment (please complete the following information):
-Java version "1.8.0_162"
Java(TM) SE Runtime Environment (build 1.8.0_162-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.162-b12, mixed mode)
The text was updated successfully, but these errors were encountered: