I am using Spring boot. I have some question regarding the singleton behaviour of spring boot beans. I am using beans which are singleton. So they will have only one instance per application.
But doubt I have is that
a) Application will create just 1 instance for each request OR application will create just 1 instance for all Requests ?
b) I have create one Service & one static variable in it. SO what is happening now is that in one request I am changing the value & in another request, if am getting the variable, I am getting the changed values? Why is that?
c) ALso same behaviour exists when the variable are not static, just normal class variable? Why is that?
d) Also what would be the good way to store the data which is request specific e.g. Lets say in each request I generate transaction Id & I want to use it in 10 different places in request. So how do I save it per request or do I have to pass it every where. Consider I have 1000 of requests per second. So obviously I can't set class level variables otherwise values will be overridden every time as beans are not thread-safe.