私はOSGiの初心者です。数時間グーグルで検索しましたが、答えが見つかりませんでした。私の理解が間違っているのかもしれません。だから問題。コンポーネントがあるとします。
<component name="sample.component" immediate="true">
<implementation class="sample.SampleComparator" />
<service>
<provide interface="java.util.Comparator" />
</service>
</component>
そしてコードで:
ServiceReference[] serviceReferences =
bundleContext.getServiceReferences(
java.util.Comparator.class.getName(), "(name=sample.component)");
しかし、私は得るnull
。間違いはどこですか?フィルターは(name=sample.component)
合っていますか?または、サービスのIDを設定して検索するにはどうすればよいですか?