2 Replies Latest reply on Jan 8, 2019 4:06 AM by bingochen

    ProcessInjectionPoint.setInjectionPoint() doesn't work in some environment.

    bingochen

      My project use weld-se-core and weld-servlet-core that version is 3.0.5.Final. I use undertow(eagerFilterInit=true) as project servlet container. I have some servlets that were injected some services. The CDI injection are available in Servlets, Filters and Listeners, but the ProcessInjectionPoint.setInjectionPoin()  doesn't work on servlet's  injection point, but work fine on the other beans.

       

      The code snippet is as follows:

       

      class SomeExtension implements Extension{

           void onProcessInjectionPoint(@Observes ProcessInjectionPoint<?, ?> pip, BeanManager beanManager) {

                //...

                pip.setInjectionPoint(new SomeInjectionPoint()); // this was work fine in common beans, but doesn't work on the servlet injection, use configureInjectionPoint().addQualifiers()  is similar.

           }

      }

       

      @ApplicationScoped

      @WebServlet(urlPatterns = "/some")

      public class SomeServlet extends HttpServlet {

           @Inject

           SomeService someService; // in this inject, I add some additional qualifiers, but it doesn't work.

      }

       

      @ApplicationScoped

      public class SomeService  {

           @Inject

           OtherService otherService; // in this inject, I add some additional qualifiers,  it work fine. use same Extension observes method.

      }

      M

      Who can tell me why, or what I'm missing?