|
From: Colin S. <col...@ex...> - 2003-11-10 23:11:29
|
As opposed to an attribute, you could re-use the 'ref' element, directly under the 'bean' element to state a dependency. In fact, my colleage didn't look too carefully at the dtd and tried to do that directly, to get what he wanted. Having a 'dependency' attribute is probably clearer though... jürgen höller [werk3AT] wrote: >I've been asked that by co-workers too. In all our cases, we managed to solve the issue by redesigning the application objects so that such side-effects that other beans depend on are avoided. Nevertheless, I've repeatedly considered adding Ant-style "depends" support, possibly via a "depends-on" attribute of the "bean" tag, with a comma-separated list of bean names as value. > >On bean creation, the bean factory would simply have to call getBean for those bean names first, before actually creating the bean instance. That would be easy enough to add (compared to constructor resolution or such stuff), so I might do this alongside breakfast tomorrow ;-) Are there any objections to such an option? If not, I suggest to add this already for 1.0 M3. > >Juergen > >________________________________ > >Von: spr...@li... im Auftrag von Colin Sampaleanu >Gesendet: Mo 10.11.2003 23:26 >An: spr...@li... >Betreff: [[W3-SPAM]] - [Springframework-developer] Forcing dependencies between singleton beans without one actually being a property of another - Email found in subject > > > >I had a co-worker ask me if there was a way to force the creation/usage >of a singleton bean B to first create another bean, A, without A >actually needing to be a property of B. He needs this because A has some >side-effects which B depends on, to work properly. > >Of course there are some artificial ways to cause this to happen, but I >can't think of anything too clean. Is this worth adding as a built-in >capability? > > |