I have been reading Spring Framework's official documentation and I came across this sentence:
As a rule, you should use the prototype scope for all stateful beans and the singleton scope for stateless beans.
This is the link to the related section.
Is it because of thread safety that we should not use singleton scope for stateful beans?
Note about the above question: I can understand using singleton scope for stateless beans. Stateless beans are immutable and they are thread-safe by definition. So, using singleton scope for those beans would be a reasonable choice. I know global state is considered evil and using singleton scope for stateful beans (I assume those beans can also be mutable) can cause undesired effects. What caused trouble for me was that these ideas were stated as a rule in the documentation. What keeps someone to use singleton scope for stateful beans in a single threaded environment, for instance? I know, it is still not a very good idea, but anyway. The point of the question is to know if there is rationale behind this rule other than thread-safety.