Skip to main content

Using @Inject and @OSGiService to access multiple references

Please note these java.net forums are being decommissioned and use the new and improved forums at https://community.oracle.com/community/java.
No replies
kmart216
Offline
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.