[seam-issues] [JBoss JIRA] Commented: (SEAMFACES-165) @Inject for Validators doesn't work with MyFaces

Christian Kaltepoth (JIRA) jira-events at lists.jboss.org
Tue May 24 02:31:01 EDT 2011


    [ https://issues.jboss.org/browse/SEAMFACES-165?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12603840#comment-12603840 ] 

Christian Kaltepoth commented on SEAMFACES-165:
-----------------------------------------------

I did some more research on this. Actually this seems to be a bug in Weld 1.1.0 and not in Seam Faces. Let me explain:

{{SeamApplicationWrapper}} waits for the {{PostConstructApplicationEvent}} and then obtains the {{ApplicationFactory}} from the {{FactoryFinder}}. Then it calls {{ApplicationFactory.setApplication()}} to install the Seam Faces wrapper.

With MyFaces the {{SeamApplicationWrapper}} gets the {{WeldApplicationFactory}} from the {{FactoryFinder}}. Unfortunately {{SeamApplicationWrapper}} ignores calls to {{setApplication()}} and simply delegates them to the underlying {{ApplicationFactory}}. The problem here is that {{SeamApplicationWrapper}} already holds a reference to the {{Application}} instance that it returns for {{getApplication()}} and doesn't update this reference when {{setApplication()}} is called. Therefore {{SeamApplicationWrapper}} will return the old {{Application}} instance on future calls to {{getApplication()}}.

See the code of {{WeldApplicationFactory}}:

https://github.com/weld/core/blob/master/environments/servlet/core/src/main/java/org/jboss/weld/environment/servlet/jsf/WeldApplicationFactory.java

For Mojarra the situation is a bit different. When using Mojarra Seam Faces calls {{setApplication()}} on Mohjarra's {{InjectionApplicationFactory}}, which wraps {{SeamApplicationWrapper}}. As {{InjectionApplicationFactory}} implements {{setApplication()}} correctly, the bug doesn't occur on Mojarra.

Does this sound reasonable? If you agree to my explanation I could open a ticket for Weld regarding this.

> @Inject for Validators doesn't work with MyFaces
> ------------------------------------------------
>
>                 Key: SEAMFACES-165
>                 URL: https://issues.jboss.org/browse/SEAMFACES-165
>             Project: Seam Faces
>          Issue Type: Bug
>          Components: Validation & Conversion
>    Affects Versions: 3.0.1
>         Environment: Tomcat 7.0.8, MyFaces 2.0.5, Weld 1.1.0
>            Reporter: Christian Kaltepoth
>
> @Inject doesn't work for validators when using MyFaces. The fields are always null.
> If I run the application with Mojarra instead of MyFaces everything works fine.
> I'm note completely sure if it is a Seam Faces or a MyFaces issue.

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the seam-issues mailing list