有人可以解释一下如何将 OSGI DS 配置为单例吗?我使用 Equinox 作为 OSGi 容器。
可控硅元件
<?xml version="1.0" encoding="UTF-8"?>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="Simple Dictionary">
<implementation class="foo.bar.services.DictionaryImpl"/>
<service>
<provide interface="foo.bar.services.Dictionary"/>
</service>
</scr:component>
OSGI 控制台输出
osgi> services (objectClass=foo.bar.services*)
{foo.bar.services.Dictionary}={
component.name=Simple Dictionary,
component.id=0,
service.id=51,
service.bundleid=7,
service .scope=bundle
}
"由捆绑注册:" foo.bar.services_1.0.0.qualifier [7]
"没有捆绑使用服务。"