|
From: <jue...@we...> - 2004-02-09 16:09:37
|
Jon, You should never rely on bean ordering in a context definition file. = Bean definitions are internally stored in a HashMap; the original order = will *not* be preserved. Bean factory internals have been significantly = reworked in the last couple of months, so there might indeed be a change = in the actual loading order. Note that Spring will automatically initialize dependent beans first. So = if you express dependencies via <ref> tags, the referenced beans will = get initialized first (recursively). If you have non-obvious = dependencies without direct references, you can declare "depends-on" = attributes at the <bean> level: The beans whose names are specified = there will get initialized before the respective bean then. In your case, you could declare = depends-on=3D"myController1,myController2,..." on the <bean> definition = of your master controller. The actual definition order of your = controllers in the XML file doesn't matter, so you're free to place this = master controller definition anywhere. Juergen -----Original Message----- From: spr...@li... [mailto:spr...@li...]On Behalf Of Jon Mountjoy Sent: Monday, February 09, 2004 4:51 PM To: spr...@li... Subject: [Springframework-developer] Bean order in applicationContext.xml changed? How to force order. Hi, I used to use M2, now M4. I suspect that something has changed between the two versions, with respect to the order in which beans that are declared in applicationContext.xml, are instantiated. Unfortunately I can't immediately check this as rolling back my changes are going to take a few hours. Can anybody confirm that this has taken place? Previously, I believe the syntactic order played a role (subject to dependency resolution). I have a nasty situation in which as my controllers are loaded, they register security information about themselves with a class. A "master" controller that needs to be loaded last, uses this registered information in its configuration. In M2 I placed this class last in the dispatcher-servlet.xml, and it got instantiated last. =20 Is there anyway that I can specify this dependency, or change some Spring component to honour syntactic order as much as possible? Thanks Jon =09 =09 =09 ___________________________________________________________ BT Yahoo! Broadband - Free modem offer, sign up online today and save = =A380 http://btyahoo.yahoo.co.uk ------------------------------------------------------- The SF.Net email is sponsored by EclipseCon 2004 Premiere Conference on Open Tools Development and Integration See the breadth of Eclipse activity. February 3-5 in Anaheim, CA. http://www.eclipsecon.org/osdn _______________________________________________ Springframework-developer mailing list Spr...@li... https://lists.sourceforge.net/lists/listinfo/springframework-developer |