Pete,<br><br>So, I've always treated Nonbinding as not binding against the parameter, treating separate values as separate qualifiers.� When using a producer, you end up needing separate producers for each value that you want to support.� This thought is roughly what I was trying to dive through.<br>
<br>John<br><br><div class="gmail_quote">On Thu, Sep 8, 2011 at 12:19 PM, Pete Muir <span dir="ltr"><<a href="mailto:pmuir@redhat.com">pmuir@redhat.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
Oh yes, let me redo it ;-)<br>
<div class="im"><br>
@Retention(RUNTIME)<br>
@interface Foo {<br>
<br>
�String bar();<br>
<br>
}<br>
<br>
And use it:<br>
<br>
@RequestScoped<br>
class A {<br>
<br>
�/// Illegal<br>
�@Inject InjectionPoint ip;<br>
<br>
}<br>
<br>
class B {<br>
<br>
</div>@Inject @Foo(bar="baz") A a;<br>
<br>
}<br>
<br>
class C {<br>
<br>
@Inject @Foo(bar="qux") A a;<br>
<div class="im"><br>
}<br>
<br>
And then let's say we have:<br>
<br>
@RequestScoped<br>
class D {<br>
<br>
@Inject C c;<br>
@Inject B b;<br>
<br>
}<br>
<br>
</div><div class="im">On 8 Sep 2011, at 12:15, John D. Ament wrote:<br>
<br>
> I think something's wrong with your example, but I think I get what you mean.<br>
><br>
> My point is that if Foo were a qualifier and not just an annotation, should they really be the same injected instance?<br>
<br>
</div>If "bar" was binding, it would be a different instance, if bar was non binding, it would be the same instance.<br>
<div class="im"><br>
> �It seems like @Nonbinding when used in @RequestScoped is irrelevant,<br>
<br>
</div>It's not really relevant or irrelevant, it's just orthogonal. @Nonbinding affects type bean resolution, which is an orthogonal concept to scoping of beans.<br>
<br>
But a non binding attribute is still non binding when used with @RequestScoped.<br>
<div class="im"><br>
> but i'm not sure the spec makes this clear (though in actuality I'm against that idea that it wouldn't work).<br>
<br>
</div>I think we still have a mismatch in understanding here, as really @Nonbinding has nothing to do with scoping, which is why the spec doesn't call this out.<br>
<div><div></div><div class="h5"><br>
><br>
> On Thu, Sep 8, 2011 at 11:59 AM, Pete Muir <<a href="mailto:pmuir@redhat.com">pmuir@redhat.com</a>> wrote:<br>
> No.<br>
><br>
> Continuing my example, I introduce some new annotation (not a qualifier):<br>
><br>
> @Retention(RUNTIME)<br>
> @interface Foo {<br>
><br>
> � String bar();<br>
><br>
> }<br>
><br>
> And use it:<br>
><br>
> @RequestScoped<br>
> class A {<br>
><br>
> �/// Illegal<br>
> �@Inject InjectionPoint ip;<br>
><br>
> }<br>
><br>
> class B {<br>
><br>
> @Inject @Bar("baz") A a;<br>
><br>
> }<br>
><br>
> class C {<br>
><br>
> @Inject @Bar("qux") A a;<br>
><br>
> }<br>
><br>
> And then let's say we have:<br>
><br>
> @RequestScoped<br>
> class D {<br>
><br>
> @Inject C c;<br>
> @Inject B b;<br>
><br>
> }<br>
><br>
> The *same* instance of A will be injected into B & C when D is accessed. The injection points allow access to the Annotated, which reflects two different injection points.<br>
><br>
> Not gonna work ;-)<br>
><br>
><br>
> On 8 Sep 2011, at 11:40, John D. Ament wrote:<br>
><br>
> > Pete, Mark,<br>
> ><br>
> > So I get there is no single injection point, however it should be the case that every injection point is declared the same way, no? �E.g. they're the "same" in the sense that the line of code is the same, but different in that they exist in different areas.<br>
> ><br>
> > John<br>
> ><br>
> > On Wed, Sep 7, 2011 at 8:38 AM, Pete Muir <<a href="mailto:pmuir@redhat.com">pmuir@redhat.com</a>> wrote:<br>
> > For a request scoped bean there is not a single injection point, like there is for dependent beans. Say I have a request scoped bean, Bean A.<br>
> ><br>
> > I have two other beans, of any scope, Bean B and Bean C.<br>
> ><br>
> > If both beans B and C inject A in the same request, then the injection point for A is both Bean B and Bean C.<br>
> ><br>
> > Furthermore, client proxies mean that bean A is instantiated lazily, to solve the circular injection problem, and so has no knowledge of it's injection point when actually created.<br>
> ><br>
> > On 7 Sep 2011, at 01:10, John D. Ament wrote:<br>
> ><br>
> > > CDI Experts<br>
> > ><br>
> > > Was wondering if you could help me understand rationale. �In request scoped objects, when you create a producer method that creates request scoped instances, why is there no access to the underlying injection point?<br>
> > ><br>
> > > Let's say that you have a qualifier with a single String value attribute that is nonbinding; let's say @JmsDestination. �You have the following injection points:<br>
> > ><br>
> > > @Inject @JmsDestination("jms/MyQueue") MessageProducer queueProducer;<br>
> > > @Inject @JmsDestination("jms/MyTopic") MessageProducer topicProducer;<br>
> > ><br>
> > > In this case, two distinct MessageProducers should be injected. �The CDI container should be able to differentiate the two, since they have different values on the qualifier. �However, CDI disallows this since the producer methods used to create them would not have access to the injection point. �If a second injection point is found, CDI should return the same instance.<br>
> > ><br>
> > > I hope it doesn't sound like I'm babbling, but I wanted to put the question out there to see if it's something that could be addressed.<br>
> > ><br>
> > > Regards,<br>
> > ><br>
> > > John<br>
> > > _______________________________________________<br>
> > > cdi-dev mailing list<br>
> > > <a href="mailto:cdi-dev@lists.jboss.org">cdi-dev@lists.jboss.org</a><br>
> > > <a href="https://lists.jboss.org/mailman/listinfo/cdi-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/cdi-dev</a><br>
> ><br>
> ><br>
><br>
><br>
<br>
</div></div></blockquote></div><br>