2 Replies Latest reply on Oct 25, 2012 8:32 AM by olpf

    @PostContruct called twice

    olpf

      Hi,

       

      making my first steps with CDI I faced the following: in gets some resources by @Inject, when I debug the @PostConstruct method the @PostConstruct method will be invoked before the injections are done and then a second time when the injects were done. I thought the @PostConstruct should be only called after the injection. All is done on the same instance of the class and the call stack points to weld, so I think it is sure that not another DI container also evaluates the annotations. This happens in a DAO class which is injected in a stateless EJB on JBoss 7.1.1 with weld 1.1.10. I ran into this because I added some checks in @PostConstruct if all was injected properly and on the 1st call, the injected resources are all null. It this a bug?

       

      Regards

      Oliver