-
1. Re: Question about @Specializes
alin.heyoulin.qq.com Jun 19, 2010 10:06 PM (in response to slaweksa)@Specializes
public class SpecBean extends TestBean {
@Override //??????
public void handleEvent(@Observes Date date) {
System.out.println(SpecBean - handle event -
+ date);
}
} -
2. Re: Question about @Specializes
slaweksa Jun 21, 2010 10:46 AM (in response to slaweksa)Thank you for your answer. I changed implementation of SpecBean:
@Specializes public class SpecBean extends TestBean { @Override //added public void handleEvent(@Observes Date date) { System.out.println("SpecBean - handle event - " + date); } }
But it didn't change the behavior. I am still getting two notifications in log.
greetings
Slawomir
-
3. Re: Question about @Specializes
alin.heyoulin.qq.com Jun 21, 2010 1:19 PM (in response to slaweksa)Goode question. You have two bean Observe this event. TestBean and SpecBean. You can't extends TestBean. Just
@Specializes
public class SpecBean {public void handleEvent(@Observes Date date) {
System.out.println(SpecBean - handle event -
+ date);
}
}
or veto TestBean or make TestBean as interface. -
4. Re: Question about @Specializes
slaweksa Jun 21, 2010 3:14 PM (in response to slaweksa)Thanks for help.
I’ve found my mistake SpecBean should be also annotated with @Alternative annotation. After this change event is handled only one time.