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 |  Blog | Github | LinkedIn | Tomitriber