[cdi-dev] JSF 2.3 and specifying alternatives for build-in producers

arjan tijms arjan.tijms at gmail.com
Wed Nov 5 13:21:11 EST 2014


Hi,

For JSF 2.3 we're currently working on providing build-in producers
for various JSF artefacts.We're basically using the approach that I
outlined here: http://jdevelopment.nl/dynamic-cdi-producers

I noticed CDI is using a similar approach for its build-in producers,
e.g. the one for HttpServletRequest (in Weld:
org.jboss.weld.bean.builtin.ee.HttpServletRequestBean).

Now we're currently putting these producers in an API package, to give
the user a chance to override them, but I noticed CDI is not doing
this. All producers are in implementation packages.

After some experimentation I couldn't really succeed in providing an
alternative producer for the CDI produced HttpServletRequest. I tried
the obvious things, like an @Produces method in a bean annotated with
@Alternative but that didn't work. Registered the bean as alternative
in beans.xml, tried the uhm alternative @Priority method, tried
different priority ranges, etc but my own producer was never called.

Am I missing something very obvious, or is it not trivial to provide
an alternative for build-in producers?

Kind regards,
Arjan Tijms


More information about the cdi-dev mailing list