[jboss-jira] [JBoss JIRA] (WFLY-13754) Allow injection for JSF artifacts

Ricardo Martin Camarero (Jira) issues at jboss.org
Fri Aug 7 05:59:00 EDT 2020


     [ https://issues.redhat.com/browse/WFLY-13754?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Ricardo Martin Camarero updated WFLY-13754:
-------------------------------------------
    Steps to Reproduce: 
The issue was discovered testing the mojarra test-suite with wildfly. The test [injectArtifacts|https://github.com/eclipse-ee4j/mojarra/tree/master/test/javaee6web/injectArtifacts] checks for this feature.

Deploy the attached {{test-javaee6web-injectArtifacts.war}}. The test cannot be directly compiled cos wildfly doesn't inject any {{com.sun.faces}} object, so the test suite {{com.sun.faces.test}} is also not injected, I modified the test to use another package name (see [this line|https://github.com/wildfly/wildfly/blob/20.0.1.Final/jsf/injection/src/main/java/org/jboss/as/jsf/injection/JSFInjectionProvider.java#L58]).

Access the app: [http://localhost:8080/test-javaee6web-injectArtifacts/]

Only the phase-listener is injected (all the elements are created by the JSF impl but not properly initialized by the CDI):
{noformat}
FacesConfigApplicationFactory: null @PostConstruct called
FacesConfigActionListener: null @PostConstruct called
FacesConfigNavigationHandler: null @PostConstruct called
FacesConfigViewHandler: null @PostConstruct called
FacesConfigStateManager: null @PostConstruct called
FacesConfigELResolver: null @PostConstruct called
FacesConfigResourceHandler: null @PostConstruct called
FacesConfigSystemEventListener: null @PostConstruct called
FacesConfigPhaseListener: Injected from value specified in web.xml @PostConstruct called
{noformat}

  was:
The issue was discovered testing the mojarra test-suite with wildfly. The test [injectArtifacts|https://github.com/eclipse-ee4j/mojarra/tree/master/test/javaee6web/injectArtifacts] checks for this feature.

Deploy the attached {{test-javaee6web-injectArtifacts.war}}. The test cannot be directly compiled cos wildfly doesn't inject ant {{com.sun.faces}} object, so the test suite {{com.sun.faces.test}} is also not injected, I modified the test to use another package name (see [this line|https://github.com/wildfly/wildfly/blob/20.0.1.Final/jsf/injection/src/main/java/org/jboss/as/jsf/injection/JSFInjectionProvider.java#L58]).

Access the app: http://localhost:8080/test-javaee6web-injectArtifacts/

Only the phase-listener is injected (all the elements are created by the JSF impl but not properly initialized by the CDI):

{noformat}
FacesConfigApplicationFactory: null @PostConstruct called
FacesConfigActionListener: null @PostConstruct called
FacesConfigNavigationHandler: null @PostConstruct called
FacesConfigViewHandler: null @PostConstruct called
FacesConfigStateManager: null @PostConstruct called
FacesConfigELResolver: null @PostConstruct called
FacesConfigResourceHandler: null @PostConstruct called
FacesConfigSystemEventListener: null @PostConstruct called
FacesConfigPhaseListener: Injected from value specified in web.xml @PostConstruct called
{noformat}



> Allow injection for JSF artifacts
> ---------------------------------
>
>                 Key: WFLY-13754
>                 URL: https://issues.redhat.com/browse/WFLY-13754
>             Project: WildFly
>          Issue Type: Bug
>          Components: JSF
>    Affects Versions: 20.0.1.Final
>            Reporter: Ricardo Martin Camarero
>            Assignee: Ricardo Martin Camarero
>            Priority: Major
>         Attachments: test-javaee6web-injectArtifacts.war
>
>
> In the JSF 2.3 specification chapter {{5.4.1 JSF Managed Classes and Java EE Annotations}} the following statement is said:
> {quote}JSF Implementations that are running as a part of Java EE 5 (or later) must allow managed bean implementations to use the annotations specified in section 14.5 of the Servlet 2.5 Specification to allow the container to inject references to container managed resources into a managed bean instance before it is made accessible to the JSF application. Only beans declared to be in request, session, or application scope are eligible for resource injection.
> {quote}
> {quote}In addition to managed beans being injectable in this manner, the following JSF artifacts are also injectable.
> {quote}
> And the following table of JSF classes are listed:
>  * javax.el.ELResolver
>  * javax.faces.application.ApplicationFactory
>  * javax.faces.application.NavigationHandler
>  * javax.faces.application.ResourceHandler
>  * javax.faces.application.StateManager
>  * javax.faces.component.visit.VisitContextFactory
>  * javax.faces.context.ExceptionHandlerFactory
>  * javax.faces.context.ExternalContextFactory
>  * javax.faces.context.FacesContextFactory
>  * javax.faces.context.PartialViewContextFactory
>  * javax.faces.event.ActionListener
>  * javax.faces.event.SystemEventListener
>  * javax.faces.lifecycle.ClientWindowFactory
>  * javax.faces.lifecycle.LifecycleFactory
>  * javax.faces.event.PhaseListener
>  * javax.faces.render.RenderKitFactory
>  * javax.faces.view.ViewDeclarationLanguageFactory
>  * javax.faces.view.facelets.FaceletCacheFactory
>  * javax.faces.view.facelets.TagHandlerDelegateFactory
> The JIRA WFLY-6617 added phase listeners for injection but in general this should follow the spec and allow injection in all the commented components. The idea is adding some more elements available for injection as mojarra did (check [this issue|https://github.com/javaee/javaserverfaces-spec/issues/763]).



--
This message was sent by Atlassian Jira
(v7.13.8#713008)


More information about the jboss-jira mailing list