3 Replies Latest reply on Oct 17, 2006 12:04 PM by Gavin King

    PostConstruct annotation

    Monkey Den Master

      In the Javadoc this annotation shows:

      "The PostConstruct annotation is used on a method that needs to be executed after dependency injection is done to perform any initialization."

      However, when I try to run this code:

      @Logger
      private Log log;
      
      @PostConstruct
      public void someMethod(){
       log.debug("Some message");
       ....
      }


      ...it chokes on the logger with a NullPointer. The method meets all the requirements for @PostConstruct. Naturally, if I replace this line with a call to System.out, it works as expected.