Scopes and the Blueprint Container

In the Blueprint programming model, you use the scope setting to determine whether a bean manager creates single or multiple object instances.

The Blueprint Container specification defines two main scopes:
singleton
The bean manager creates a single instance of the bean and returns that instance every time that the manager is requested to provide an object. This is the default for top-level bean managers.
prototype
The bean manager creates a new instance of the bean every time that the manager is requested to provide an object. This is the default for bean managers that are specified inline.

The following Blueprint XML example code shows how to set a singleton scope for a bean manager.

<bean id=”singletonAccount” class=“org.apache.aries.simple.Account” 
   scope=”singleton”>
   <argument value=”5”/>
</bean>

The following Blueprint XML example code shows how to set a prototype scope for a bean manager.

<bean id=”prototypeAccount” class=“org.apache.aries.simple.Account” 
   scope=”prototype”>
   <argument value=”4”/>
</bean>

Icon that indicates the topic type Concept topic

Terms and conditions for information centers | Feedback


Timestamp icon Last updated: Saturday, 20 October 2012
http://www14.software.ibm.com/webapp/wsbroker/redirect?version=v700osgijpa&product=was-nd-mp&topic=ca_blueprint_scopes

Copyright IBM Corporation 2009, 2012.
This information center is powered by Eclipse technology. (http://www.eclipse.org)