Assume that we have Spring bean UserController with
All my further reasoning is based on my assumption that "singleton" scope is almost similar to application scope i.e. we have only one instance for all users. If this is wrong assumption then tell me about it, please.
So, we have a web-form with several fields. Two users fill this form simultaneously. And they both press Submit button at the same time. Our UserController is a backing bean for that form.
My question: is it possible that part of the fields in UserController will contain values from first user, and the rest of the fields will contain values from the second user?
You are right that
WebApplicationContextis stored in the
ServletContext, so it's one per application.
Your controllers shoud not be of
singletonscope. They should be either
sessionscoped. Your service layer should consist of
If your controller is
singletonit is pretty certain that the whole thing will be messed up ;)