I have a problem injecting a org.osgi.framework.ServiceRegistration object.
Suppose the following declaration:
osgi:service id="myServiceRegistration" ref="beanToPublish"
According to the spring dm docs, there is now a bean defined in the application context with id="myServiceRegistration" of type "org.osgi.framework.ServiceRegistration"
However, when I try to inject a reference to this bean into another bean like this:
<bean id="beanToPublish" class="com.xyz.beanToPublish">
<property name="serviceRegistration"><ref bean="myServiceRegistration"/></property>
I get the following error (both declarations are in the same bundle):
org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'myServiceRegistration': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'myBean' defined in URL [bundleentry://21/META-INF/spring/application-context.xml]: Cannot resolve reference to bean 'myServiceRegistration' while setting bean property 'registration'; nested exception is org.springframework.beans.factory.BeanCurrentlyInC reationException: Error creating bean with name 'myServiceRegistration': FactoryBean which is currently in creation returned null from getObject
So the problem seems to be that spring dm cannot resolve the name "myServiceRegistration" although it has been defined (through osgi:service id). Any ideas? Thank you!