@FacesConverter
and @FacesValidator
are not eligible for EJB or managed bean injection points up to JSF 2.2.
They are supposed to work with JSF 2.3 (currently available as a milestone only) using an additional managed
attribute with @FacesConverter
and @FacesValidator
as mentioned here.
In JSF 2.1 very few JSF artifacts were injection targets. In JSF 2.2 injection was made possible in a huge amount of additional artefacts but the very ones where injection actually matters most, converters and validators, were mysteriously left in the cold.
In JSF 2.3 this has now finally been taken care of as the following artefacts have been added to the list of injection targets:
javax.faces.convert.Converter
javax.faces.validator.Validator
javax.faces.component.behavior.Behavior
However, in contrast to the artefacts already on this list these new 3 are not automatically injection targets. They will only become so when a new attribute called "managed" on the corresponding annotations
@FacesConverter
,@FacesValidator
and@Behavior
is set to true. Furthermore all these 3 annotations have been upgraded to being CDI qualifiers by adding the@Qualified
annotation to their definition.The existing attributes of
@FacesConverter
,@FacesValidator
and@Behavior
have not been modified, meaning they are all binding, as is the new attribute "managed".
The attribute managed
is however, unavailable in Mojarra 2.3.0-m02.
Is it because of a milestone? Is it dependent upon a specific Weld/CDI version? I am currently going with GlassFish Server 4.1. Different artifact versions are mentioned here (The default Weld version supplied by the server version is 2.2.2 final).