top button
Flag Notify
    Connect to us
      Facebook Login
      Site Registration

Facebook Login
Site Registration

What is the difference between Singleton pattern and Springs Beans being Singleton?

+3 votes
146 views
What is the difference between Singleton pattern and Springs Beans being Singleton?
posted Sep 17, 2015 by anonymous

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

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 ...

answer Apr 19, 2016 by Karthick.c
Contact Us
+91 9880187415
sales@queryhome.net
support@queryhome.net
#280, 3rd floor, 5th Main
6th Sector, HSR Layout
Bangalore-560102
Karnataka INDIA.
QUERY HOME
...