Eager ApplicationScoped managed beans constructed multiple times

前端 未结 2 1100
醉梦人生
醉梦人生 2021-01-01 02:08

I have a bunch of eager ApplicationScoped managed beans. Some of them are injected into others by the ManagedProperty annotation, forming

2条回答
  •  余生分开走
    2021-01-01 02:22

    I have hopefully resolved this problem on Tomcat 8 + Mojarra 2.2.0. In my case I just removed listener declaration from web.xml

    
        com.sun.faces.config.ConfigureListener
    
    

    Constructor seems to be called once afterwards.

    About listener entry, there is a part of BalusC answer of this question.

    In any case, the explicit registration of Mojarra's ConfigureListener in web.xml is actually only necessary to workaround old buggy servers such as GlassFish v3 and Jetty who failed to find the listener in Mojarra's TLD file. When deployed to a decent server, the whole entry is unnecessary.

提交回复
热议问题