users@jersey.java.net

Re: Injectable fields not set on target object for proxied resource (using cglib)

From: Martin Grotzke <martin.grotzke_at_javakaffee.de>
Date: Sat, 08 Mar 2008 02:23:19 +0100

Hi,

> We may need another method on ComponentProvider e.g. Object
> getInjectableInstance(Object resource) that Jersey can call and
> perform injection on the returned instance. Or we have to provide a
> context as before.
Yep, s.th. like that would be nice. Would getInjectableInstance be
invoked for all components, or just those that were created by the
custom (spring) ComponentProvider?

Cheers,
Martin


On Fri, 2008-03-07 at 22:29 +0100, Paul Sandoz wrote:
>
> On Mar 7, 2008, at 6:41 PM, Duncan Eley wrote:
>
> > Hi Paul,
> >
> > I've not looked in any great detail at the new component provider
> > but I can't see how the AOP trick can be applied using it. The
> > getInstance() method in the SPI by Marc gave access to a
> > ResourceProviderContext. This allowed me to inject dependencies on
> > the proxy's target object and then return the proxied object itself
> > from getInstance(). The target object cannot be the object returned
> > from getInstance().
> >
> > Using the component provider, how can we do the DI on the target
> > object? Or there there some other solution to this that I'm not
> > aware of?
> >
> >
>
>
> Ah! you are right, can you please log an issue so that i don't forget
> about this?
>
>
> We may need another method on ComponentProvider e.g. Object
> getInjectableInstance(Object resource) that Jersey can call and
> perform injection on the returned instance. Or we have to provide a
> context as before.
>
>
> Thanks,
> Paul.
>
>
> > Many thanks,
> >
> > Duncan Eley
> >
> >
> > ----- Original Message ----
> > From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
> > To: users_at_jersey.dev.java.net; dunk_e_at_yahoo.co.uk
> > Sent: Friday, 7 March, 2008 4:55:04 PM
> > Subject: Re: Injectable fields not set on target object for proxied
> > resource (using cglib)
> >
> > Duncan Eley wrote:
> > > The above example uses the SPI described here:
> > > http://weblogs.java.net/blog/mhadley/archive/2007/09/integrating_jer.html.
> > > This demonstrates how to get at the cglib proxied object using
> > > Spring. However, I'm aware that the Jersey SPI has changed quite a
> > > bit since I did this.
> >
> > Yes, you should be able to do the same AOP trick with the component
> > provider [1].
> >
> >
> > > It would be really nice, if at some point, Jersey had an optional
> > > library for users wanting to integrate with Spring.
> > >
> >
> > Very much agree. I would like to consider something like that for
> > 0.7
> > (see my blog on the 0.6 release), my concern is Marc, Jakub and I
> > are a
> > little maxed out so i was wondering if anyone would like to
> > volunteer to
> > contribute Spring & Guice stuff to the Jersey distribution ?
> >
> > Paul.
> >
> > [1] http://blogs.sun.com/sandoz/entry/integrating_jersey_and_spring_take
> >
> > --
> > | ? + ? = To question
> > ----------------\
> > Paul Sandoz
> > x38109
> > +33-4-76188109
> >
> >
> >
> >
> >
> > ____________________________________________________________________
> > Sent from Yahoo! Mail.
> > The World 's Favourite Email.
>