Sunday, June 3, 2012

Spring Framework- Bean Scope


Spring provide the facility to define the scope of bean ,to set limit instances or define area of bean. To define the bean scope set the scope properties with different parameters-

1.singleton-Allow the bean to a single instance per container.
2.prototype-Allow bean to be instantiate any number of times.
3.request-Allow a bean definition to an HTTP request.
4.session-Allow a bean definition to an HTTP session.
5.global-session-Allow a bean definition to a global HTTP session,used in only context.

Example of set the property scope-
   <bean id="scope" class="com.test.BeanScopeProgram" scope="singleton"></bean>


For Further Reading,
General, Java, spring

0 comments:

Post a Comment


 

Site Status

Man Behind Technical Today

Hello, I am Navin Bansal. I am a student of MCA in Rajsthan Institute of Engineering and Technology and owner of this blog. I share my view and ideas among people.