-
Jul 30th, 2008, 01:51 PM
#1
"Plug and Play" with Spring
I have a situation where I have a class that will have a list of listeners that it will iterate over to perform actions. What makes this difficult is that there are separate groups of these listeners, and also a lot of them. In the regular implementation, we used:
<bean name="caller">
<property name="listeners">
<list>
<ref A>
<ref B>
<ref C>
...
</list>
</property>
</bean>
Is there a way to have listeners add themselves to the listener list? I thought the merge command might work, where 'A' would set 'caller' as its parent, same with 'B', and so on. I then thought that because of the parent/child relationship, I would only have one element in the resulting list.
The closest way we found was to have the 'A', 'B', 'C' have a setter that took a list, and instead of setting internal data, added themselves to the singleton list that was passed in. Is there a better way to do this?
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules