users@jersey.java.net

Re: [Jersey] IoC: Inject instance of type that has two configured beans

From: Martin Grotzke <martin.grotzke_at_freiheit.com>
Date: Fri, 06 Jun 2008 17:57:14 +0200

On Fri, 2008-06-06 at 13:49 +0200, Paul Sandoz wrote:
> Martin Grotzke wrote:
> > On Fri, 2008-06-06 at 12:22 +0200, Paul Sandoz wrote:
> >> Martin Grotzke wrote:
> >>> Hi Paul,
> >>>
> >>> On Fri, 2008-06-06 at 10:56 +0200, Paul Sandoz wrote:
> >>>> Hi Martin,
> >>>>
> >>>> Perhaps we could pass a ComponentContext to a new getInstance method:
> >>>>
> >>>> <T> T getInstance(ComponentContext cc, Scope scope, Class<T> c)
> >>>>
> >>>> This ComponentContext could present the AccessibleObject, Annotation[]
> >>>> and Annotation (if any are present).
> >>> Sounds good!
> >>>
> >>>> I think it necessary that @Inject would need to be modified anyway if
> >>>> you want to support it on constructor/method params, since the parameter
> >>>> name is not available (plus there is no direct accessible object, the
> >>>> closest is the constructor or method).
> >>> What do you think how @Inject would have to be modified / should look
> >>> like?
> >>>
> >> I think it needs have an optional name parameter, a bit like EE
> >> @Resource. I cannot think of anything else. From your use-case that
> >> would appear sufficient to uniquely identify different instances.
> > Sounds good. Are you going to implement this, can I help with s.th.?
> >
>
> How about I do the Jersey related stuff, and when finished you do spring
> support for @Inject ?
Yes, let's do it like this.

Cheers,
Martin


>
> Paul.