grose
journeyman
Joined: 08/04/2006 07:58:08
Messages: 17
Location: Terracotta, Inc.
Offline
|
Hi Sateesh,
It actually depends how you have coded the context loading. For instance, if your code looked something like this
new ClassPathXmlApplicationContext({ "config/foo.xml",
"config/bar.xml" });
and your config looked something like:
<paths>
<path>config/foo.xml</path>
<path>config/bar.xml</path>
</paths>
or this
<paths>
<path>*</path>
</paths>
that code should work. However, paths in the config are used for matching
only, but the name for the implicit context root in DSO is derived from the actual resource names. So, if you used the second configuartion, and you were to load those same contexts again, but use foo2.xml and bar2.xml, you will have two distinct DSO roots and beans won't be shared between these two contexts.
Also, as the call stack is used to calcuate the root name, you can only see that two app contexts are clustered if that new ClassPathXmlApplicationContext(..) call happens in the same call stack.
I would suggest loading the Spring contexts on init, store in them some kind of map, and then retrieve specific context instance using a key from their messages. Is this workable in your application?
Regards,
Gordon
|