Skip to main content

Using @Inject and @OSGiService to access multiple references

Please note these forums are being decommissioned and use the new and improved forums at
No replies
Joined: 2012-05-30

Is there a way to use the @Inject and @OSGiService annotation or some other way in a JSF Managed Bean or regular servlet that is inside a Web Application Bundle to access multiple service implementations for a single OSGi service interface?

If I was using BND component annotation, I would do this:

@Reference(multiple = true)
public void setService(SomeService serviceInstance)
// method would be called each time a service is registered

As far as I know, I can't do this as the class when then be managed by the declarative service runtime and no longer by Glassfish.