You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@karaf.apache.org by jb...@apache.org on 2011/01/26 07:19:16 UTC

svn commit: r1063608 - /karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf

Author: jbonofre
Date: Wed Jan 26 06:19:16 2011
New Revision: 1063608

URL: http://svn.apache.org/viewvc?rev=1063608&view=rev
Log:
[KARAF-412] Add notes on how to make multiple configuration files available to the bundle context.

Modified:
    karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf

Modified: karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf
URL: http://svn.apache.org/viewvc/karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf?rev=1063608&r1=1063607&r2=1063608&view=diff
==============================================================================
--- karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf (original)
+++ karaf/trunk/manual/src/main/webapp/users-guide/provisioning.conf Wed Jan 26 06:19:16 2011
@@ -191,6 +191,25 @@ Such configuration as usually used with 
 <ctx:property-placeholder properties-ref="cmProps" />
 {code}
 
+There may also be cases where you want to make the properties from multiple configuration files available to your bundle context. This is something you may
+want to do if you have a multi-bundle application where there are application properties used by multiple bundles, and each bundle has its own specific
+properties. In that case, {{<ctx:property-placeholder>}} won't work as it was designed to make only one configuration file available to a bundle context.
+ To make more than one configuration file available to your bundle-context you would do something like this:
+
+{code:lang=xml}
+<beans:bean id="myBundleConfigurer"
+            class="org.springframework.beans.factory.config.PropertyPlaceholderConfig">
+    <beans:property name="ignoreUnresolvablePlaceholders" value="true"/>
+    <beans:property name="propertiesArray">
+        <osgix:cm-properties id="myAppProps" persistent-id="myApp.props"/>
+        <osgix:cm-properties id="myBundleProps" persistent-id="my.bundle.props"/>
+    </beans:property>
+</beans:bean>
+{code}
+
+In this example, we are using SpringDM with osgi as the primary namespace. Instead of using ctx:context-placeholder we are using the "PropertyPlaceholderConfig"
+class. Then we are passing in a beans array and inside of that array is where we set our osgix:cm-properties elements. This element "returns" a properties bean.
+
 For more informations about using the Configuration Admin service in Spring-DM, see the [Spring-DM documentation|http://static.springframework.org/osgi/docs/1.2.0-m2/reference/html/compendium.html#compendium:cm:props].
 
 h3. Feature resolver