2013-11-14 36 views

回答

1

你必須使用回調來檢索服務屬性:

@Bind 
public void bindService(HelloService hello, Dictionary<String, Object> properties) { 
     // ... 
} 

@Bind 
public void bindService(HelloService hello, Map<String, Object> properties) { 
    // ... 
} 

你甚至可以獲取OSGi服務註冊:

@Bind 
public void bindService(HelloService hello, ServiceReference<HelloService> reference) { 
    // ... 
} 

個所有的細節都在http://felix.apache.org/documentation/subprojects/apache-felix-ipojo/apache-felix-ipojo-userguide/describing-components/service-requirement-handler.html#note-about-callbacks

+0

謝謝,這是很酷另外,如果財產已被更改或不我能察覺:@Modified 公共無效modifiedService(HelloService的招呼,地圖<字符串,對象>屬性){// ... } – naweed