下面列出了怎么用org.springframework.context.support.AbstractXmlApplicationContext的API类实例代码及写法,或者点击链接到github查看源代码。
/**
* 初始化某个版本的rule
*/
private synchronized boolean initVersionRule(String data, String version) {
if (version == null) {
version = NO_VERSION_NAME;
}
ApplicationContext ctx = null;
try {
// this rule may be wrong rule,don't throw it but log it,
// and will not change the vtr!
ctx = buildRuleByStr(version, data);
} catch (Exception e) {
throw new TddlNestableRuntimeException(e);
}
VirtualTableRoot tempvtr = (VirtualTableRoot) ctx.getBean(ROOT_BEAN_NAME);
if (tempvtr != null) {
// 直接覆盖
vtrs.put(version, tempvtr);
ruleStrs.put(version, data);
AbstractXmlApplicationContext oldCtx = this.oldCtxs.get(version);
// 销毁旧有容器
if (oldCtx != null) {
oldCtx.close();
}
// 记录一下当前ctx
this.oldCtxs.remove(version);
this.oldCtxs.put(version, (AbstractXmlApplicationContext) ctx);
} else {
logger.error("rule no vtabroot!!");
return false;
}
return true;
}
/**
* 初始化某个版本的rule
*/
private synchronized boolean initVersionRule(String data, String version) {
if (version == null) {
version = NO_VERSION_NAME;
}
ApplicationContext ctx = null;
try {
// this rule may be wrong rule,don't throw it but log it,
// and will not change the vtr!
ctx = buildRuleByStr(version, data);
} catch (Exception e) {
logger.error("init rule error,rule str is:" + data, e);
return false;
}
VirtualTableRoot tempvtr = (VirtualTableRoot) ctx.getBean(ROOT_BEAN_NAME);
if (tempvtr != null) {
// 直接覆盖
vtrs.put(version, tempvtr);
ruleStrs.put(version, data);
AbstractXmlApplicationContext oldCtx = this.oldCtxs.get(version);
// 销毁旧有容器
if (oldCtx != null) {
oldCtx.close();
}
// 记录一下当前ctx
this.oldCtxs.remove(version);
this.oldCtxs.put(version, (AbstractXmlApplicationContext) ctx);
} else {
logger.error("rule no vtabroot!!");
return false;
}
return true;
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/routingslip-header.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/aggregate-abc-eager.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/camel-route-xml.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/aggregate-timeout-threadpool.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/camel-route-defer-xml.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext(new String[]{"camelinaction/rider-spring-prod.xml", "camelinaction/rider-spring-test.xml"});
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/camel-route-java.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/aggregate-abc-hawtdb.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/aggregate-abc-close.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/splitter-abc.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/camel-route-java.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/aggregate-abc.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/camel-route.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/wiretap.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/failover-loadbalancer.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/earlyreply-context.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/route-parallel.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/BigFileSedaTest.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/random-loadbalancer.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/BigFileFixedThreadPoolTest.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/aggregate-abc-leveldb.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/loadbalancer.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/CustomThreadPoolProfileTest.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/aggregate-xml.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/camel-route-java.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/aggregate-abc-group.xml");
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext(new String[]{"META-INF/spring/spring-security.xml"});
}
@Override
protected AbstractXmlApplicationContext createApplicationContext() {
return new ClassPathXmlApplicationContext("META-INF/spring/failover-roundrobin-loadbalancer.xml");
}