[weld-dev] Dynamic Injection Question

Jordan Ganoff jganoff at gmail.com
Thu Apr 8 08:23:29 EDT 2010


I'm using Weld 1.0.1 Final.  You fixed a very similar bug:
https://jira.jboss.org/jira/browse/WELD-438.  From your comment on the JIRA
it sounded like the selected annotations were fixed as well but that's not
the behavior I'm seeing.

On Thu, Apr 8, 2010 at 7:38 AM, Pete Muir <pmuir at redhat.com> wrote:

> Are you using Weld 1.0.1 - I fixed this there IIRC.
>
> On 8 Apr 2010, at 02:45, Jordan Ganoff wrote:
>
> > I was testing out a simple idea for another JMS injection type and ran
> into an issue with Instance.get() and additional select annotations.  The
> InjectionPoint of the producer lacked the additional selected annotations.
>  I'm trying to create a TopicProducer and need to dynamically inject a
> topic.  When the topic producer is invoked the InjectionPoint does not
> contain the JmsDestination (the annotations are only @Inject and @Any, which
> seems like @Inject shouldn't be there either).  Is there a better way to do
> this?
> >
> > Here's the code:
> >
> > @Inject @Any Instance<Topic> anyTopic;
> >
> > @Produces @JmsDestination
> > public TopicPublisher createTopicProducer(InjectionPoint ip, Session s)
> throws JMSException
> > {
> >    Topic t =
> anyTopic.select(ip.getAnnotated().getAnnotation(JmsDestination.class)).get();
> >    return TopicPublisher.class.cast(s.createProducer(t));
> > }
> >
> > ...
> >
> > @Produces
> > @JmsDestination
> > public Topic getTopic(InjectionPoint ip, @Module Context c) throws
> NamingException
> > {
> >    JmsDestination d =
> ip.getAnnotated().getAnnotation(JmsDestination.class);
> >    return (Topic) c.lookup(d.jndiName());
> > }
> >
> > Thanks in advance.
> >
> > P.S. Actual code links:
> >
> > http://gist.github.com/359673
> >
> http://github.com/jganoff/seam3-jms/blob/master/src/main/java/org/jboss/seam/jms/impl/inject/DestinationProducer.java
> > --
> > Jordan Ganoff
> > _______________________________________________
> > weld-dev mailing list
> > weld-dev at lists.jboss.org
> > https://lists.jboss.org/mailman/listinfo/weld-dev
>
>


-- 
Jordan Ganoff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/weld-dev/attachments/20100408/4a514709/attachment-0001.html 


More information about the weld-dev mailing list