private void processPhaseListeners ( final DeploymentUnit deploymentUnit , final Set < String > managedBeanClasses ) { for ( final VirtualFile facesConfig : getConfigurationFiles ( deploymentUnit ) ) { InputStream is = null ; try { is = facesConfig . openStream ( ) ; final XMLInputFactory inputFactory = XMLInputFactory . newInstance ( ) ; inputFactory . setXMLResolver ( NoopXMLResolver . create ( ) ) ; XMLStreamReader parser = inputFactory . createXMLStreamReader ( is ) ; StringBuilder phaseListenerName = null ; int indent = 0 ; boolean lifecycle = false ; boolean phaseListener = false ; while ( true ) { int event = parser . next ( ) ; if ( event == XMLStreamConstants . END_DOCUMENT ) { parser . close ( ) ; break ; } if ( event == XMLStreamConstants . START_ELEMENT ) { indent ++ ; if ( indent == 2 ) { if ( parser . getLocalName ( ) . equals ( LIFECYCLE ) ) { lifecycle = true ; } } else if ( indent == 3 && lifecycle ) { if ( parser . getLocalName ( ) . equals ( PHASE_LISTENER ) ) { phaseListener = true ; phaseListenerName = new StringBuilder ( ) ; } } } else if ( event == XMLStreamConstants . END_ELEMENT ) { indent -- ; phaseListener = false ; if ( indent == 1 ) { lifecycle = false ; } if ( phaseListenerName != null ) { managedBeanClasses . add ( phaseListenerName . toString ( ) . trim ( ) ) ; phaseListenerName = null ; } } else if ( phaseListener && event == XMLStreamConstants . CHARACTERS ) { phaseListenerName . append ( parser . getText ( ) ) ; } } } catch ( Exception e ) { JSFLogger . ROOT_LOGGER . phaseListenersConfigParseFailed ( facesConfig ) ; } finally { try { if ( is != null ) { is . close ( ) ; } } catch ( IOException e ) { // Ignore } } } }
WFLY - 6617 According to JSF 2 . 2 spec it should be possible to inject beans using