Announcement Announcement Module
Collapse
No announcement yet.
Event handling targeting prototype beans Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Event handling targeting prototype beans

    Hi all,

    Does anyone happen to know what the expected behavior is for the standard configuration of event handling, when the class that is targeted is a bean with prototype scope.

    From what I see not all instances of this prototype receive applicationEvents.

    At a given point registerListeners is executed for the applicationContext, which first looks for statically specified listeners and secondly ads all values the following method returns getBeansOfType(ApplicationListener.class, true, false).values();

    This implies that a new instance is created of the prototype and registered as listener.

    Newly created instances are not registered and thus receive no application events.

    Could this be solved by creating a custom ApplicationEventMulticaster that somehow manages to load instances of a given prototype bean as listeners when executing multicastEvent()?

    Regards,

    Stefan Koulouris


    // Nevermind, solved the problem by setting the applicationEventMulticaster on the class that generates the instances. This way new listeners can be registered.
    Last edited by StefanosK; Jul 26th, 2007, 06:59 AM.
Working...
X