Announcement Announcement Module
Collapse
No announcement yet.
Publishing Events to Listeners Registered within Child Contexts Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Publishing Events to Listeners Registered within Child Contexts

    I have a set up where I have some nested application contexts (A contains B contains C and D). Currently when I publish an event to A neither B, C, nor D receive this event. This isn't what I expected since beans and other information in ancestral contexts is available to descendant contexts. Is there an option to enable such a propagation of events?

  • #2
    Originally posted by daleth View Post
    I have a set up where I have some nested application contexts (A contains B contains C and D). Currently when I publish an event to A neither B, C, nor D receive this event. This isn't what I expected since beans and other information in ancestral contexts is available to descendant contexts. Is there an option to enable such a propagation of events?
    I have a feeling that this is the correct behavior and that like BeanFactoryPostProcessor's, the ApplicationListener will only apply to the bean factory that the listener is configured in (not its child bean factories). This would be consistent with the behavior you've specified, although I can't find it explicitly written in the reference documentation.

    static.springframework.org/spring/docs/2.0.x/reference/beans.html#context-functionality-events

    I do not know of a clean way of propagating the events. Anybody else have any ideas?

    Comment


    • #3
      Yeah, unfortunately I couldn't find any documentation that described how this functionality worked within a hierarchical context model.

      Comment


      • #4
        If you want this you will have to program it yourself. The default is that the childs can see everything from the parent, but the parent doesn't know anything about the childs (which is correct IMHO). So if you want to listen to events from the parent, you will have to create something yourself.

        Comment

        Working...
        X