[jboss-user] [JBoss Seam] - PostConstruct annotation

monkeyden do-not-reply at jboss.com
Mon Oct 16 12:39:22 EDT 2006

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.

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=3978596#3978596

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=3978596

More information about the jboss-user mailing list