I am new to Spring. I was looking at bean scope attribute and saw that the default value is Singleton.
I looked at one of the application at my organization and at no place did I see any mention of scope "Prototype". In this case, none of the domain model objects were getting created using Spring, and there was no threading issue with the objects that were created using bean factory.
It looked to me like a static methods would have done the job wherever objects were specified as singletons.
So, when do I select the bean scope to be prototype?
If the default is Singleton, looks like Spring suggests and encourages to create only one instance as long as possible (except say for threading issues, persistence objects ...). Isn't this same as having static methods (Here I am overlooking the fact that bean in singleton scope is single within one bean factory's scope only, whereas static methods will be shared across classloader)?


Reply With Quote
. I'll try to look at the factory-type role of Spring in this light.
