[cdi-dev] RequestScoped and Injection Points

Jozef Hartinger jharting at redhat.com
Thu Sep 8 02:17:36 EDT 2011



On 09/07/2011 02:10 AM, John D. Ament wrote:
> CDI Experts
>
> 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?
>
> 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:
>
> @Inject @JmsDestination("jms/MyQueue") MessageProducer queueProducer;
> @Inject @JmsDestination("jms/MyTopic") MessageProducer topicProducer;
>
> 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.
The CDI container is be able to differentiate the two. By annotating the 
qualifier's member with @NonBinding, you explicitly asked the container 
it to ignore the difference.
> 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.
>
> 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.
>
> Regards,
>
> John
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev


More information about the cdi-dev mailing list