How to override bnd Require-Capability generated from DS annotation?

半世苍凉 提交于 2019-12-24 05:49:26

问题


I have a bundle with an "optional" Component : It should be started if at leat one service of type X exist, and deactivated when the last service is unregistered.

This component is "optional": It doesn't matter if X is registered or not, or if my component is activated or not. It's just an helper for managing instances of X.

My component is declared like this :

@Component
public class MyManager {

  @Reference(cardinality=AT_LEAST_ONE)
  public void addService(X service) { .. }
}

However, bnd generate a Require-Capability for at least one service X.

How can I tell bnd that my component is optional, and all it dependencies are optionals ? I can change the implementation of my component to add lazynes "by hand", but I would rather use DS capabilities.

来源:https://stackoverflow.com/questions/38322981/how-to-override-bnd-require-capability-generated-from-ds-annotation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!