-
Notifications
You must be signed in to change notification settings - Fork 110
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Injection in @FacesValidator and friends does not work always #5075
Comments
The bug is confirmed also with
Injection does not work even declaring the name of validator to solve I use one the following workaround: Alternative 1: use manual injection inside the validate method
Alternative 2: use @ApplicationScoped if the validator is "stateless"
where BeanService is like:
|
Reproduced.
That's indeed expected. Technical explanation is that the Mojarra implementation explicitly searches for an instance literally annotated as such. I.e. |
Fix #5075: add support to CDI-resolve @FacesValidator without ID
Injection in a Facesvalidator still (at least Tomcat 10.0.18, Mojarra 3.0.2, Weld 5.0.0.CR2) does not work, althouth the class is annotated with @FacesValidator(managed = true) . All injected attributes stay null and produce NPE as a consequence.
A surprising hot fix is to use @FacesValidator(value = "xxxValidator", managed = true), i.e., to set a name is necessary instead using by default the className for that.
Please note that this is a very old bug already, see #4245, #4645 for further details. I know from my students that small things like these are very frustrating and unfortunately (and unjustly) fire too often a bad opinion about JSF among them.
The text was updated successfully, but these errors were encountered: