[cdi-dev] Question about section 4.2

Romain Manni-Bucau rmannibucau at gmail.com
Tue Jul 2 09:13:12 EDT 2013


Hi

i think @EJB Foo<Bar> ignores Bar (or at least the ejb spec doesnt define
it)

*Romain Manni-Bucau*
*Twitter: @rmannibucau <https://twitter.com/rmannibucau>*
*Blog: **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/>
*LinkedIn: **http://fr.linkedin.com/in/rmannibucau*
*Github: https://github.com/rmannibucau*



2013/7/2 Pete Muir <pmuir at redhat.com>

>
> On 2 Jul 2013, at 11:28, John D. Ament <john.d.ament at gmail.com> wrote:
>
> > Hi all
> >
> > In section 4.2 of the CDI spec (both 1.0 and 1.1) there are references
> to injection around generic types.  I was wondering if someone could
> clarify this case?
> >
> > I have an interface:
> >
> > public interface Handler<? extends Foo> { ... }
> >
> > and then I have two implementations
> >
> > public class FarlowHandler implements Handler<Farlow> { .. }
> >
> > public class BagelHandler implements Handler<Bagel> { ... }
> >
> > Is it expected that I should be able to inject references to these by
> doing:
> >
> > @Inject
> > private Handler<Farlow> fHandler;
> >
> > @Inject
> > private Handler<Bagel> bHandler;
>
> Yes.
>
> >
> > ?  Is there any expected difference when using EJBs?
>
> Assuming the interface is part of the local client view of the EJB, then
> no. Obviously, if EJB has any rules around declaring generic types in local
> interfaces, then you need to respect those (IIRC, it doesn't).
>
>
> _______________________________________________
> cdi-dev mailing list
> cdi-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/cdi-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20130702/f1fb9f43/attachment.html 


More information about the cdi-dev mailing list