Is there a way to configure Spring to invoke the "init-method" methods after the entire context has been processed. I'm running into a case where a service is started and fires events before all its listeners have been added. The listeners are added like so:
I could add them to the service via constructor or setter injection, but that would make them dependencies of my service, which doesn't seem right. Although the system depends on them being listeners of the service, the service itself doesn't depend on them.
<property name="targetObject" ref="MyService"/>
<property name="targetMethod" value="addListener"/>
I solved this by manually starting my service after I construct the context. It's actually more complicated than that, as there are several running services that could cause MyService to fire events. I have to ensure they are all started manually after context construction.