I\'m currently trying to get a simple bundle containing a Service Factory running.
This is my factory class:
public class SvcFactory implements Servi
ServiceFactory
allows your code to provide customized service object for different bundles. Note that with ServiceFactory
, clients of your service still do not control when new instance is created, they lookup service by its interface (ServiceB
) as usual. So, for them, there is no difference if your service is registered as ServiceFactory
or not.
With declarative services, you should not implement ServiceFactory
yourself. Just add servicefactory="true"
attribute to the
element (you already did) and different instances of your component class will be created (activated) automatically for different requesting bundles. You need to specify ServiceBImpl
as an implementation class of the component.