use of com.alipay.sofa.isle.loader.DynamicSpringContextLoader in project sofa-boot by alipay.
the class BeanHierarchyTest method refreshApplication.
private void refreshApplication(ApplicationRuntimeModel application) throws Exception {
DefaultListableBeanFactory rootBeanFactory = new DefaultListableBeanFactory();
ConfigurableApplicationContext rootApplicationContext = new GenericApplicationContext(rootBeanFactory);
rootApplicationContext.refresh();
SofaModuleProperties sofaModuleProperties = new SofaModuleProperties();
sofaModuleProperties.setBeanLoadCost(1);
rootBeanFactory.registerSingleton("sofaModuleProperties", sofaModuleProperties);
rootBeanFactory.registerSingleton(SofaBootConstants.PROCESSORS_OF_ROOT_APPLICATION_CONTEXT, new HashMap<>());
SpringContextLoader springContextLoader = new DynamicSpringContextLoader(rootApplicationContext);
for (DeploymentDescriptor dd : application.getResolvedDeployments()) {
if (dd.isSpringPowered()) {
springContextLoader.loadSpringContext(dd, application);
ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) dd.getApplicationContext();
dd.startDeploy();
ctx.refresh();
dd.deployFinish();
}
}
}
use of com.alipay.sofa.isle.loader.DynamicSpringContextLoader in project sofa-boot by sofastack.
the class BeanHierarchyTest method refreshApplication.
private void refreshApplication(ApplicationRuntimeModel application) throws Exception {
DefaultListableBeanFactory rootBeanFactory = new DefaultListableBeanFactory();
ConfigurableApplicationContext rootApplicationContext = new GenericApplicationContext(rootBeanFactory);
rootApplicationContext.refresh();
SofaModuleProperties sofaModuleProperties = new SofaModuleProperties();
sofaModuleProperties.setBeanLoadCost(1);
rootBeanFactory.registerSingleton("sofaModuleProperties", sofaModuleProperties);
rootBeanFactory.registerSingleton(SofaBootConstants.PROCESSORS_OF_ROOT_APPLICATION_CONTEXT, new HashMap<>());
SpringContextLoader springContextLoader = new DynamicSpringContextLoader(rootApplicationContext);
for (DeploymentDescriptor dd : application.getResolvedDeployments()) {
if (dd.isSpringPowered()) {
springContextLoader.loadSpringContext(dd, application);
ConfigurableApplicationContext ctx = (ConfigurableApplicationContext) dd.getApplicationContext();
dd.startDeploy();
ctx.refresh();
dd.deployFinish();
}
}
}
Aggregations