Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » Injection of multiple service instances(OSGi allows to register more instances of same service. Is it possible to inject them all?)
Injection of multiple service instances [message #997313] Sat, 05 January 2013 15:45
Štěpán Mík is currently offline Štěpán MíkFriend
Messages: 1
Registered: January 2013
Junior Member
As far as I know, eclipse framework is able to inject single instance of OSGi service if target site is properly annotated.

private ISomeService service;

I'm wondering if there is a way how to inject ALL instances of service declared by interface ISomeService. As a wild guess I tried

private ISomeService[] services;

private List<ISomeService> services;

Both do not work. Is there an another solution? Or are there plans how to to achieve this?
I think that it is not uncommon situation when application wants to use all service implementations, not one selected by the framework. Even java CDI has the javax.enterprise.inject.Instance<T> that provides iterator over all candidates for injection.
BTW: It would be nice to have something like OSGi("query") qualifier to specify service being injected:
@OSGi("LDAP expression")
private ISomeService[] services;

thank you for advices

Previous Topic:Problems with launching Eclipse 4 applications
Next Topic:How to find MPart for currently open editor
Goto Forum:

Current Time: Fri Apr 20 03:16:13 GMT 2018

Powered by FUDForum. Page generated in 0.01690 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software