[cdi-dev] Question about section 4.2

John D. Ament john.d.ament at gmail.com
Tue Jul 2 06:28:38 EDT 2013


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;

?  Is there any expected difference when using EJBs?

John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20130702/4cb3f1d7/attachment.html 


More information about the cdi-dev mailing list