I'm using SCR
http://felix.apache.org/site/apache-felix-maven-scr-plugin.html

It's sort of difficult to pass Service objects around to plain POJO the way
my program is written. I don't like to couple my POJO with Service.
I just wanted to get an instance of Service when I needed from POJO.

I'll google for iPOJO.

Thanks.


On Sun, Oct 10, 2010 at 1:14 PM, Clement Escoffier <
clement.escoff...@gmail.com> wrote:

>
> On 10.10.2010, at 18:59, Richard S. Hall wrote:
>
> > On 10/8/10 17:38, sam lee wrote:
> >> Hey,
> >>
> >> I can get a Service instance from another Service by using:
> >>     @Reference
> >>     private MyService myService;
> >>
> >> But, how can I get a reference to MyService instance from a POJO?
> >> Since the POJO will be used in some other service, should I get
> MyService
> >> reference from the service POJO is being used and pass to it?
> >>
> >> Or, is there some factory POJO can use?
> >
> > If I understand correctly, you want to use a service in a POJO that is
> not an iPOJO component (i.e., no @Component). In that case, assuming you are
> using a recent version of iPOJO that injects proxies by default, you should
> just pass the injected reference from your component to the POJO.
>
> For iPOJO, it's exactly what Richard has described, but is this question
>  about SCR or iPOJO ? iPOJO do not have @Reference (at least not as core
> annotations)
>
> Regards,
>
> Clement
>
>
> >
> > -> richard
> >
> >> Thanks.
> >> Sam
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> > For additional commands, e-mail: users-h...@felix.apache.org
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@felix.apache.org
> For additional commands, e-mail: users-h...@felix.apache.org
>
>

Reply via email to