private AcrossApplicationContextHolder createRootContext( ConfigurableAcrossContextInfo contextInfo ) {
AbstractApplicationContext rootApplicationContext =
applicationContextFactory.createApplicationContext( context,
context.getParentApplicationContext() );
ProvidedBeansMap providedBeans = new ProvidedBeansMap();
// Create the AcrossContextBeanRegistry
AcrossContextBeanRegistry contextBeanRegistry = new DefaultAcrossContextBeanRegistry( contextInfo );
providedBeans.put( contextBeanRegistry.getFactoryName(),
new PrimarySingletonBean(
new DefaultAcrossContextBeanRegistry( contextInfo ),
new AutowireCandidateQualifier( Qualifier.class.getName(),
AcrossContextBeanRegistry.BEAN )
) );
// Put the context and its info as fixed singletons
providedBeans.put( AcrossContext.BEAN, new PrimarySingletonBean( context ) );
providedBeans.put( AcrossContextInfo.BEAN, new PrimarySingletonBean( contextInfo ) );
// Put the module info as singletons in the context
for ( AcrossModuleInfo moduleInfo : contextInfo.getConfiguredModules() ) {
// Create the module instances as primary beans so they do not clash with modules
// configured as beans in a parent application context
providedBeans.put( "across.module." + moduleInfo.getName(),
new PrimarySingletonBean(
moduleInfo.getModule(),
new AutowireCandidateQualifier( Module.class.getName(),
moduleInfo.getName() )
)
);
providedBeans.put( moduleInfo.getName(),
new SingletonBean(
moduleInfo,
new AutowireCandidateQualifier( Module.class.getName(),
moduleInfo.getName() )
)
);
providedBeans.put( "across.moduleSettings." + moduleInfo.getName(),
new SingletonBean(
moduleInfo.getSettings(),
new AutowireCandidateQualifier( Module.class.getName(),
moduleInfo.getName() )
) );