That is true. I may have to provide an implementation of DependencyAwareBeanFactoryPostProcessor that gets the configuration from CM, then post processes the bean factory with those properties at that time. I will look into that.
But there is a related problem that has come up. In the Spring-DM doc for version 1.2.0 it is recommended to use configuration admin like:
Code:
<!-- Configuration Admin entry -->
<osgix:cm-properties id="cmProps" persistent-id="com.xyz.myapp">
<prop key="host">localhost</prop>
</osgix:cm-properties>
<!-- placeholder configurer -->
<ctx:property-placeholder properties-ref="cmProps" />
The problem with this is one of timing as well. The property placeholder is actually evaluated in the first stage of application context refresh by OsgiBundleXmlApplicationContext(AbstractDelegatedE xecutionApplicationContext).startRefresh() line: 247
That stage is executed before waiting for dependencies. So even if there is a dependency on CM, the PropertyPlaceholderConfigurer has already post processed the bean factory without getting the CM properties first unless CM just happened to already be available. If CM was not available you usually get error messages like "could not resolve placeholder x".
So the current state of things means there is no way to be sure your context will read its properties from CM, because property placeholder substitution happens in stage one (preRefresh) of the context, before dependency waiting happens. I think what is required here is a DependencyAwareBeanFactoryPostProcessor version of the property placeholder configurer so that properties will be applied to the bean factory in stage two, after dependency waiting. Plus, if that bean is used it should automatically generate a wait on the org.osgi.service.cm.ConfigurationAdmin service.