Hi Costin, first thanks for the reply.
I tried following configuration:
Code:
<reference id="myService" interface="com.xyz.MyServiceInterface"/>
<bean id="serviceConsumer" class="MyServiceConsumerImpl">
<property name="serviceReferenceField" ref="myService"/>
<property name="myServiceFiled" ref="myService"/>
</bean>
I have com.xyz.MyServiceImpl bean exported as OSGi service from other bundle.
My goal is to get the com.xyz.MyServiceImpl bean injected to serviceConsumer as myServiceFiled. Not the proxy created by Spring DM. I am not interested to get the raw ServiceReference.
I don't like proxy for the service like cache interface, which could be invoked thousands times per second.
Apologize if didn't make it clear at first place.
However, I could get the raw service object by following code:
Code:
ServiceReference nativeReference = ((ServiceReferenceProxy)serviceReference).getTargetServiceReference();
com.xyz.MyServiceImpl myServiceImpl= (com.xyz.MyServiceImpl)bundleContext.getService(nativeReference);
I want to know is it possible to inject com.xyz.MyServiceImpl raw instance by configuration instead of my code. Or it could be a feature for future.
Cheers!