6 Replies Latest reply on Mar 21, 2013 7:34 AM by sfcoy

    Injecting TimerService null when base class is in different module

    sven.plath

      Hey,

       

      consider the following example:

       

      public abstract class AbstractTimerService {
                @Resource
                protected TimerService timerService;
      }
      

       

      @Singleton
      @Startup
      public class TimerBean extends AbstractTimerService {
                @PostConstruct
                private void test() {
                System.out.println("Hello Timer!");
                }
      }
      

       

      1) When both the AbstractTimerService and the TimerBean are located in one module, the TimerService gets injected.

      2) If the Abstract base class and the implementing TimerBean are located in two different modules, the TimerService is null when the test() method is invoked (and obviously stays null).

       

      Is it somehow possible to make JBoss inject the TimerService in the second case? Or is this a bug or expected by definition?

       

      Regards,

      Sven