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.
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.
@RequestScoped
open class RequestScopedBean {
var myProperty: Int? = null
var myStringProperty: String? = null
init {
println("Initializing RequestScopedBean")
}
}
Screenshots
OUTPUT WITH 3 CONSECUTIVE REQUESTS:
Environment (please complete the following information):
Microsoft Windows [Version 10.0.18362.900]
-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)
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):
https://github.com/quarkusio/quarkus/issues/10290
$upstream:10290$