2 Replies Latest reply on Jul 9, 2012 7:09 AM by Lars Fischer

    Constructor of @Singleton called multiple times

    Lars Fischer Newbie

      Hello,

       

      I use a @Singleton EJB within some  @SessionScoped CDI beans.

      The singleton does some logging inside the constructor and the @PostConstruct method.

       

      Deployed on a JBoss AS 7.1.1.Final I noticed that the constructor log statements are shown every time a new session starts.

      But I expected that the constructor is only called once.

       

      The @PostConstruct method is not called multiple times.

       

      It this behavior correct?

       

      To reproduce the effect, I created a simple example project:

      https://github.com/lfischer/jboss.singleton.example

       

       

      Regards,

      Lars