spring supports several bean scopes?

  • singleton: Singleton, the entire Spring IoC container, using only a singleton instance defined bean
  • prototype: Prototype mode, each prototype acquired by getbean method defined bean container, produces a new instance of the bean

 

Only use Spring in a Web application, request, session, global-session scope to be effective

  • request: For each HTTP request using the request will have bean defined a new instance, i.e. each HTTP request will produce different bean instance.
  • session: Session with a shared instance of a bean.
  • global-session: the same session scope is different, and all share a Session Bean instance.


Description link
 


 

 

Guess you like

Origin www.cnblogs.com/ConstXiong/p/12123261.html