Lets say I have Bundle A, and it has an Interface HelloWorld and function helloWorld()
Now, in another bundle B, I'm implementing as follows
@Service(HelloWorld.class)
@Component(immediate = true)
public class Test1Impl implements HelloWorld
{
public String helloWorld()
{
return "I'm from Bundle B";
}
}
I've another bundle C, I'm doing
@Service(HelloWorld.class)
@Component(immediate = true)
public class Test2Impl implements HelloWorld
{
public String helloWorld()
{
return "I'm from Bundle C";
}
}
Now if I need to get implementation of Bundle C only then what should I do? For example in general I do as below but it does not work in this case.
Helloworld obj = sling.getService(HelloWorld.class);
obj.helloWorld();