How to @Inject in a PhaseListener

前端 未结 2 871
既然无缘
既然无缘 2020-12-16 20:50

I have added a PhaseListener to faces-config.xml:


    com.project.NotificationListener         


        
2条回答
  •  独厮守ぢ
    2020-12-16 21:09

    If you can't go JSF 2.2 your best bet is to use Deltaspike Core.

    It offers MyCDIStuff myCDIStuff = BeanProvider.getContextualReference(MyCDIStuff.class, false);

    Deltaspike is how you should get stuff rather then inventing that yourself. For example if you must have the BeanManager (for example to fire an event) then Deltaspike core also offers BeanManagerProvider.

    http://deltaspike.apache.org/core.html

提交回复
热议问题