You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Wassim Drira <dr...@gmail.com> on 2011/08/05 12:09:29 UTC

Question about blueprint "prototype" scope

Hello,

In my Application I want to use an new instance of the service in each
client. So I have done an experience with a server and two clients. The
resulted trace is in the attachement. So the result demonstrates that the
two clients use the  same instance of the server although I use
{scope="prototype"} in the definition of the bean.  Find the used bundles in
attachement.
Can you help me to understand this issue?

Best regards,
Wassim

Re: Question about blueprint "prototype" scope

Posted by Wassim Drira <dr...@gmail.com>.
Thank you for your quick and precise response.

Wassim

On Fri, Aug 5, 2011 at 12:17, Andreas Pieber <an...@gmail.com> wrote:

> Hey Wassim,
>
> The problem is that you missunderstood the meaning of the prototype
> annotation. While blueprint will create a new bean for each injection only
> one service is exported. If you like to have such a factory you have to
> implement it yourself :-(
>
> Hopefully this answers your question.
>
> Kind regards,
> Andreas
>
>
> On Fri, Aug 5, 2011 at 12:09, Wassim Drira <dr...@gmail.com> wrote:
>
>> Hello,
>>
>> In my Application I want to use an new instance of the service in each
>> client. So I have done an experience with a server and two clients. The
>> resulted trace is in the attachement. So the result demonstrates that the
>> two clients use the  same instance of the server although I use
>> {scope="prototype"} in the definition of the bean.  Find the used bundles in
>> attachement.
>> Can you help me to understand this issue?
>>
>> Best regards,
>> Wassim
>>
>>
>

Re: Question about blueprint "prototype" scope

Posted by Andreas Pieber <an...@gmail.com>.
Hey Wassim,

The problem is that you missunderstood the meaning of the prototype
annotation. While blueprint will create a new bean for each injection only
one service is exported. If you like to have such a factory you have to
implement it yourself :-(

Hopefully this answers your question.

Kind regards,
Andreas

On Fri, Aug 5, 2011 at 12:09, Wassim Drira <dr...@gmail.com> wrote:

> Hello,
>
> In my Application I want to use an new instance of the service in each
> client. So I have done an experience with a server and two clients. The
> resulted trace is in the attachement. So the result demonstrates that the
> two clients use the  same instance of the server although I use
> {scope="prototype"} in the definition of the bean.  Find the used bundles in
> attachement.
> Can you help me to understand this issue?
>
> Best regards,
> Wassim
>
>