Hi Alex, you can use the @Reference annotation. 

Neil


On Saturday, 18 July 2015 at 13:46, Alex Sviridov wrote:

> I use org.apache.felix.framework-4.6.1.jar and a bundle 
> org.apache.felix.scr-1.8.3-SNAPSHOT.jar
> 
> And I have two bundles - bundleA and bundleB. => totally I have three bundles 
> (A,B,scr)
> 
> And in every bundle I have one declarative service. For creating DS I use 
> annotations + maven bundle plugin.
> 
> How can I use connect one service to another other using DS annotations + 
> maven bundle plugin. I mean:
> 
> BundleA   
> #############################################################################################
> import org.osgi.service.component.annotations.Component;
> import org.osgi.service.component.annotations.ServiceScope;
> 
> @Component(
>     immediate = false,
>     property={"label=defaultA"},
>      scope=ServiceScope.PROTOTYPE
> )
> public class ClassA implements InterfaceA{
> ......
> }
> 
> BundleB   
> #############################################################################################
> import org.osgi.service.component.annotations.Component;
> import org.osgi.service.component.annotations.ServiceScope;
> 
> @Component(
>     immediate = false,
>     property={"label=defaultB"},
>      scope=ServiceScope.PROTOTYPE
> )
> public class ClassB implements InterfaceB{
> 
>    private InterfaceA aService; // HOW CAN I MAKE OSGI "INJECT" HERE SERVICE 
> A WITH LABEL=DEFAULTA???
>   .....
> }
> 
> 
> 
> -- 
> Alex Sviridov
> 
> 


Reply via email to