In one bundle have interface IService, implemented by class ServiceImpl:
public interface IService
{
void doSomething();
}
@Component
@Provides
@Instantiate
public class ServiceImpl implements IService
{
public void doSomething()
{
}
}
In a second bundle I have another class, ServiceConsumer (a GoGo shell command; specific annotations not included), using the service provided in the first bundle:
@Component
@Provides
@Instantiate
public class ServiceConsumer
{
@Requires
private IService service;
public doIt()
{
service.doSomething();
}
}
When I import and start the two bundles in Felix, I can see that all my services are correctly instantiated using ipojo:instances, and that ServiceImpl provides IService. However, when doIt() is executed, service is null.
Since IService seems to be available, I would expect that @Requires inject the good instance, but it seems not to do it.
I have the feeling there's something very obvious that I'm not doing, but I have no idea what.