[cdi-dev] adding generic producers to CDI 2.0?

Romain Manni-Bucau rmannibucau at gmail.com
Fri Feb 12 11:56:42 EST 2016


Hi guys,

could CDI 2 do step forward for generic producers?

The need is to produce any type (with a particular qualifier) without the
need of an extension:

@Produces
@MyQualifier
Object create(InjectionPoint ip) { ... }

This is actually a common pattern (for configuration, or to integrate with
3rd party libs) and today the only hope to do so is to write an extension
which is a bit technical and verbose for the result IMO.

I guess for compatibility reason we would need to do something like:

@Produces
@MyQualifier
@Generic
Object create(InjectionPoint ip) { ... }

and say that if there is a unique resolved bean thanks to qualifiers which
is annotated @Generic then use this producer.

wdyt?

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20160212/7758e022/attachment-0001.html 


More information about the cdi-dev mailing list