Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个 OSGi 服务,它通过注入它们的声明性服务引用其他服务。我希望在引用服务的属性更新时收到通知。我不希望每次引用服务中的配置更改时我的主要服务都停止,因此我将策略设置为“动态”。
DS 1.2 中有一个新功能。
添加元素上的updated属性reference以命名用于接收绑定引用的服务更新的方法。
updated
reference
这将成为即将发布的 Compendium 4.3 规范的一部分。它已经在 Equinox 的 DS 实现中实现(DS 捆绑包的 1.4.0 版)。您必须http://www.osgi.org/xmlns/scr/v1.2.0在组件描述中使用命名空间才能使用该updated属性。方法使用与和方法updated相同的方法签名。bindunbind
http://www.osgi.org/xmlns/scr/v1.2.0
bind
unbind