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.

Related Posts:

  • Spring AutoWiring : constructor In this type of implicit wiring, container detect the bean instance and matches by its type with the type of the bean in the XML and then identifies the matching constructor to inject the bean dependencies. Here the autowir… Read More
  • Spring AutoWiring: Autodetect It is a type of auto-wiring in which the injection procedure may be constructor or setter injection , depends on the argumented constructor is there in the bean. Container gives priority for the constructor injection and se… Read More
  • Spring Implicit Wiring : byName In this type of implicit wiring, container detect the bean instance and matches its name with the value of the id attribute as hard-coded in the XML file with the bean tag. Some task performed by the the Container : 1. Con… Read More
  • Implicit/Auto Wiring in Spring The term auto itself says half the meaning of this wiring, that the things are done implicitly without the hard-coding any thing. Wiring defines the process of injection of the dependencies of the bean. So in Auto Wiring we… Read More
  • Spring Wiring Process In Spring wiring means configuration the bean dependency if any. It may be done explicitly by hard-coding the code in XMl file or implicitly by mentioning the required type of autowiring process in the XML file. Autowiring… Read More

0 comments:

Post a Comment

Blog Archive

Ads 468x60px

.

Ads

.

Featured Posts

Popular Posts

Like Us On FaceBook

Total Pageviews

201976

Online Members

Live Traffic