The Blueprint Container specification also defines a number of special environment managers that set the ID and provide access to the environment components. They do not have XML definitions and cannot be overridden because their IDs are protected and cannot be used by other managers. The objects provided by the environment manager can only be injected into other managers that use references. The Blueprint Container specification defines 4 environment managers:
blueprintbundle
offer package
bundle (org.osgi.framework.Bundle)
object.
blueprintbundlecontext
offer package
bundlecontext (org.osgi.framework.BundleContext)
object.
blueprintcontainer
blueprintcontainer (Org.osgi.service.blueprint.container.BlueprintContainer) Objects.
blueprintConverter
Provide the package with
Converter(org.osgi.service.blueprint.container.Converter)
Object that provides access to the Blueprint Container type conversion Tool
When used, it can be configured and used directly in the Blueprint.xml
Such as:
<bean id= "pbanklist" class= "com.lala.blueprint.client.BankListProcessor" ><property name= "bundle" ref= " Blueprintbundle "></property><property name=" Bundlecontext "ref=" Blueprintbundlecontext "></ Property><property name= "Blueprintcontainer" ref= "Blueprintcontainer" ></property><property name = "Converter" ref= "Blueprintconverter" ></property></bean>
Banklistprocessor, add variables to
Private Bundle bundle;private bundlecontext bundlecontext;private blueprintcontainer blueprintcontainer;private Converter Converter;
Finally, you need to add a dependency to the Pom.xml
<dependency><groupId>org.apache.aries.blueprint</groupId><artifactId> org.apache.aries.blueprint</artifactid><version>1.1.0</version><scope>provided</ Scope></dependency>
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Blueprint Environment Manager