1 Reply Latest reply on Nov 4, 2015 6:49 AM by Martin Kouba

    How can i get ServletContext before Container fire BeforeBeanDiscovery or AfterTypeDiscovery or AfterBeanDiscovery

    he youlin Newbie

      I want to  initialize something using ServletContext before AfterBeanDiscovery.

      For example i want start spring container before cdi start up and voted some spring bean in Extension.

       

      I changed some code in WeldServletLifecycle.java

       

      eg:

      boolean initialize(ServletContext context) {

         if (isBootstrapNeeded) {

              ............

              //bootstrap.startInitialization();      //////// splite startInitialization into beforeStartInitialization and afterStartInitialization

              bootstrap.beforeStartInitialization();

               ...................................

              manager.fireEvent(new BeforeInitContainerObjectHold(context));/////define a BeforeInitContainerObjectHold and fire. BeforeInitContainerObjectHold  hold a Object type so it can used for SE environment to hold any object

                 

             bootstrap.afterStartInitialization();

       

       

         }

       

      }

       

       

      It work for me.