Indra,
try to use org.springframework.context.access.ContextSingleto nBeanFactoryLocator, or DefaultLocatorFactory in the same package.
This singletons are intended to instantiate AppCtx using beanRefContext.xml file, where you can specify the real appCtx sources (e.g. http://org.foo/myAppCtx.xml).
But I think that just for dynamic menu loading is better other solution.
Use the mentioned ContextSingletonBeanFactoryLocator (or DefaultLocatorFactory) and specify there local appCtx files.
Create a bean like
Code:
pubilc interface MenuSource {
MenuItem getMenu();
MenuItem getMenu(MenuItem item);
MenuItem getMenu(Principal user);
...
}
public class RemoteMenuSource {
public MenuItem getMenu() {
// call the server to get the menu
// using specified remoting service
}
}
Then let the UI code, which builds the menu, use the MenuSource bean (of course configured by Spring :-). E.g.
Code:
public class ApplicationFrame {
private MenuSource menuSource;
public setMenuSource(MenuSource menuSource) {
thie.menuSource = menuSource;
}
...
public init(...) {
MenuItem mainMenu = menuSource.getMenu();
...
}
}
and config it by
Code:
<bean name="menuSource" class="RemoteMenuSource"/>
<bean name="applicationFrame" class="ApplicationFrame">
<property name="menuSource"><ref bean="menuSource"/></property>
</bean>
Hope this help