Spring can have more than one if they have different id's; meanwhile, GoF only allows one instance of the class (object) in the complete classloader.
None option can solve some thread-safe issues that may appear by the composition of other objects that are nor thread-safe, JDBC connections, HTTP session, SimpleDateFormat, etc.
Update:
From that URL:
Summary
Spring Singleton is very different from Singleton pattern. Spring guarantees to create only one bean instance for given bean id definition per container.Singleton pattern ensures that one and only one instance is created per ClassLoader.
No comments :
Post a Comment