Bean instance created by spring container can be in one of the following scopes.
  1. Singleton
  2. Prototype
  3. Request
  4. Session
  5. Global-Session
Singleton : When bean scope is singleton only one instance will be created for that bean and the same instance will be returned when you call getBean() method. Singleton is the default scope in ApplicationContext container. When scope of bean is singleton than default loading type is aggressive loading.

Prototype : When bean scope is prototype then new instance will be created for that bean when you call getBean() method. When scope is prototype the default loading type is lazy loading.

Request : Request scope is equal to HttpServletRequest in web application it means for every new request a new instance will be created.

Session : Session scope is equal to HttpSession scope in web application. It means for new instance per user.

Global-Session : Global-Session scope is equals to session in portlet based web application.

0 comments:

Post a Comment

Blog Archive

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

Online Members

Live Traffic