4 Replies Latest reply on Jun 21, 2010 3:14 PM by Slawomir Sawa

    Question about @Specializes

    Slawomir Sawa Newbie

      Hello,


      I'm playing with @Scpecializes annotation. I have problem with events  - I have two beans:


      public class TestBean {
      
              public void handleEvent(@Observes Date date) {
                      System.out.println("TestBean - handle event - " + date);
              }
      }
      
      @Specializes
      public class SpecBean extends TestBean {
      
              public void handleEvent(@Observes Date date) {
                      System.out.println("SpecBean - handle event - " + date);
              }
      }
      
      



      I fire event:


              @Inject Event<Date> event;
              private void runTest1() {
                      event.fire(new Date());
      
              }
      


      and I get two notification in log informing me that event was handled:


      INFO: SpecBean - handle event - Wed Jun 16 16:33:25 EDT 2010
      INFO: SpecBean - handle event - Wed Jun 16 16:33:25 EDT 2010
      


      It says that event was handled by specialized bean (it's ok) but why two times? Am I doing something wrong?
      I run it on Glassfish v 3.0.1



      Greetings and thanks in advance.


      Slawomir