Popular Posts

Monday, April 02, 2012

Difference between Singleton design pattern & Spring Singleton bean scope


What is the difference between Spring Singleton bean scope & Singleton Design pattern? or how are they different ?


Singleton pattern is described at per class loader level.
Singleton bean scope is per spring container. Spring simply creates a new instance of that class and that is available in the container to all class loaders which use that container. 


Suppose you have two scenarios:
1. There are multiple class loaders inside the same spring container..
2. There are multiple containers using same class loader..


In first case - you will get 1 instance while in case 2 - you will get multiple instances ...


References: 
http://www.techienjoy.com/Spring-Singleton-GOF-Singleton-Difference.php
http://forum.springsource.org/showthread.php?113507-Diff-between-Spring-singleton-and-Singleton-design-pattern

9 comments:

mary Brown said...

There are other scopes are also available like

application
websocket

Thread Scope

Java Training in Chennai

Saradha Devi said...

Great one
Best Selenium Training in Chennai | Android Training in Chennai | Java Training in chennai | Webdesigning Training in Chennai

Rajapriya R said...

nice and good blog to read.... really i gathered some information thanks for sharing

java training in chennai | java training institute in chennai | java j2ee training in chennai | java j2ee training institute in chennai

for IT the said...

I have read your blog its very attractive and impressive. I like it your blog.

Java Training in Chennai Core Java Training in Chennai Core Java Training in Chennai

Java Online Training Java Online Training Core Java 8 Training in Chennai Core java 8 online training JavaEE Training in Chennai Java EE Training in Chennai

for IT the said...

Hibernate Online Training Hibernate Online Training Hibernate Training in Chennai Hibernate Training in Chennai Java Online Training Java Online Training

Hibernate Training Institutes in ChennaiHibernate Training Institutes in Chennai Java Online Training Java Online Training Java Online Training Java Online Training

srihariparu said...

I have read your blog, its very interesting and useful to everyone. Thank you Keep updating.We are offering..
Embedded Project Center in Chennai | Mat Lab Project Center in Chennai | Image Processing Project Center in Chennai

renuka devi said...


It is very wonderful blogs, thanks for sharing the information

Master Java certification Training | Java Training in Chennai

Ani International said...


law college
law college in Jaipur
Best law college in Jaipur
Law Course In Jaipur
Top College Of law In Jaipur
Vidyasthali Law College
Best Law College
Jaipur Law College

Ani International said...


organic cold pressed oils
natural cold pressed oils
organic oil
organic oil in jaipur
organic cold pressed oil in jaipur
natural oil
natural oil shop in jaipur
pure herbal oil
ayurvedic oil store in jaipur
ayurvedic oil