本文整理匯總了Java中org.springframework.context.support.GenericXmlApplicationContext.setParent方法的典型用法代碼示例。如果您正苦於以下問題:Java GenericXmlApplicationContext.setParent方法的具體用法?Java GenericXmlApplicationContext.setParent怎麽用?Java GenericXmlApplicationContext.setParent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.springframework.context.support.GenericXmlApplicationContext
的用法示例。
在下文中一共展示了GenericXmlApplicationContext.setParent方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: createSubContext
import org.springframework.context.support.GenericXmlApplicationContext; //導入方法依賴的package包/類
public AbstractApplicationContext createSubContext(final AbstractApplicationContext parent, final String path, final boolean allowBeanOverride) {
final GenericXmlApplicationContext subContext = new GenericXmlApplicationContext();
subContext.setParent(parent);
subContext.setAllowBeanDefinitionOverriding(allowBeanOverride);
subContext.load(path);
subContext.refresh();
return subContext;
}
示例2: deploy
import org.springframework.context.support.GenericXmlApplicationContext; //導入方法依賴的package包/類
@Override
public Promise<String> deploy(String springTemplate) {
Resource templateResource = new ByteArrayResource(springTemplate.getBytes());
GenericXmlApplicationContext appContext = new GenericXmlApplicationContext();
appContext.setParent(applicationContext);
appContext.load(templateResource);
appContext.refresh();
ApplicationStack applicationStack = appContext.getBean("applicationStack", ApplicationStack.class);
applicationStack.deploy();
return applicationStack.getUrl();
}
示例3: createContext
import org.springframework.context.support.GenericXmlApplicationContext; //導入方法依賴的package包/類
/**
* @param springConfig
*/
public void createContext(final String springConfig) {
// Detect whether this app is configured with an XML or @Configuration.
if (springConfig.endsWith(".xml")) {
context = new GenericXmlApplicationContext();
context.setParent(parent);
((GenericXmlApplicationContext) context).load(springConfig);
}
else {
context = new AnnotationConfigApplicationContext();
context.setParent(parent);
try {
Class<?> c = Class.forName(springConfig);
((AnnotationConfigApplicationContext) context).register(c);
} catch (ClassNotFoundException e) {
throw new IllegalArgumentException(e);
}
}
if (!listeners.isEmpty()) {
for (ApplicationListener<?> listener : listeners) {
context.addApplicationListener(listener);
}
listeners.clear();
}
ConfigurableListableBeanFactory factory = context.getBeanFactory();
BeanPostProcessor vertxSupportProcessor = new VertxAwareBeanPostProcessor(vertx);
factory.addBeanPostProcessor(vertxSupportProcessor);
BeanPostProcessor containerSupportProcessor = new ContainerAwareBeanPostProcessor(container);
factory.addBeanPostProcessor(containerSupportProcessor);
}