title: Different beans scope in spring?
body: <p>i am bit confused among the 3 scopes i.e request, prototype and singleton explained at 
  <a href="http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch04s04.html" rel="nofollow">http://static.springsource.org/spring/docs/3.0.0.M3/reference/html/ch04s04.html</a>. My doubts are:- </p>
  
  <p>RequestScope :-say a web request comes from client, In the same request we are creating the bean with statement factory.getBean("MyBean1")
  will it return two different instances. My understanding is it will return the same instance as it is done under the same http request. Right? While it will return the two different
  instances in case of prototype request. Correct?</p>
  
  <p>Prototype:- Itis results in the creation of a new bean instance every time a request for that specific bean is made.
  As a rule of thumb, you should use the prototype scope for all beans that are stateful, while the singleton scope should be used for stateless beans.
  How come its differnt from request scope and how its support for stateful beans.</p>
  
  <p>Singleton:- its written under section under 4.4.1.</p>
  
  <blockquote>
    <p>Please be aware that Spring's concept of a singleton bean is quite different from the Singleton pattern as defined in the seminal 
    Gang of Four (GoF) patterns book. The GoF Singleton hardcodes the scope of an object such that one and only one instance of a particular 
    class will ever be created per ClassLoader. The scope of the Spring singleton is best described as per container and per bean.</p>
  </blockquote>
  
  <p>My question here is on statement "The scope of the Spring singleton is best described as per container and per bean"</p>
  
  <p>per container:-Can we have more than one core conatiner in any application? My understanding is
  that if we are creating BeanFactory factory = new XmlBeanFactory("MyXml") two times in an applicaton , we can say two container instance exist.Right?
  in this case we can two instances of bean even if it is declared singleton. Is this correct?</p>
  
  <p>It is stated on some websites that it is stated that Spring core container avoid the need of programming the singleton. Here do they mean we dont have to code for singleton container
  will provide it for us. Right? Question here is If we declare the public constructor in bean. will container still provide the singleton for that bean(scope is singleton in xml file for this bean)? </p>