I currently have a observer type pattern which I need to represent in my spring XML configuration. Originally I did this like this:

Code:
<bean id="listener" scope="singleton"/>
<bean id="teller" lazy-init="false" scope="singleton">
    <property name="listener" value="listener" />
</bean>
This meant that whenever I retrieved a (well, the) listener, there was already a teller attached to it (and already telling it things).

The problem is now that I want lots of tellers/listeners, so they cannot be singletons any more. I really need a configuration which says on the 'listener' bean that it has a 'weak' dependency on the 'teller' bean - i.e. instantiate it afterwards with the original 'listener' bean as the dependency.

Of course I could code the 'listener' to automatically lookup a 'teller' and attach itself to it, but of course I'd rather inject this.

Is this possible? Am I going about this the wrong way?

Thanks

_jpg_