On Wed, Aug 24, 2016 at 2:17 PM, mduduzik <[email protected]> wrote:

> I would like to create and new instance of component for every service
> request. I believe by default a component is a singleton - i.e. the same
> instance will be returned for every service consumer request. In DS/SCR,
> this is accomplished by using a factory property in @Component declaration.
>

Correction! That is done by using the prototype scope [1][2].

To do this outside of DS use a PrototypeServiceFactory [3]

Sincerely,
- Ray

[1]
https://osgi.org/javadoc/r6/cmpn/org/osgi/service/component/annotations/Component.html#scope()
[2]
https://osgi.org/javadoc/r6/cmpn/org/osgi/service/component/annotations/ServiceScope.html#PROTOTYPE
[3]
https://osgi.org/javadoc/r6/core/org/osgi/framework/PrototypeServiceFactory.html



> Thanks.
> -Mdu
>
>
>
>
> --
> View this message in context: http://apache-felix.18485.x6.
> nabble.com/DM4-service-factory-multiple-service-
> instance-support-tp5018226.html
> Sent from the Apache Felix - Users mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
*Raymond Augé* <http://www.liferay.com/web/raymond.auge/profile>
 (@rotty3000)
Senior Software Architect *Liferay, Inc.* <http://www.liferay.com>
 (@Liferay)
Board Member & EEG Co-Chair, OSGi Alliance <http://osgi.org> (@OSGiAlliance)

Reply via email to