0 Replies Latest reply on Mar 26, 2018 10:08 AM by Francesco Marchioni

    ManagedExecutorService gets injected null in REST Service

    Francesco Marchioni Apprentice

      Hi all!

      I'm running a test of a REST Service on WildFly 12. I've noticed that ManagedExecutorService executorService gets injected null in a REST Service:

      @Resource(name = "DefaultManagedExecutorService")
      ManagedExecutorService executorService;
      public void test() {      
       System.out.println("executorService:"+executorService); // Null


      On the other hand, a basic Servlet in the same project gets injected the Executor correctly:


      @Resource(name = "DefaultManagedExecutorService")
      ManagedExecutorService executor;
          protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
              PrintWriter writer = response.getWriter();
              executor.execute(new SimpleTask());     
              writer.write("Task SimpleTask executed! check logs");

      The above code works.


      Should I raise a JIRA for that ?