本文整理汇总了Java中com.taobao.tddl.rule.utils.StringXmlApplicationContext类的典型用法代码示例。如果您正苦于以下问题:Java StringXmlApplicationContext类的具体用法?Java StringXmlApplicationContext怎么用?Java StringXmlApplicationContext使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
StringXmlApplicationContext类属于com.taobao.tddl.rule.utils包,在下文中一共展示了StringXmlApplicationContext类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseSequence
import com.taobao.tddl.rule.utils.StringXmlApplicationContext; //导入依赖的package包/类
public void parseSequence(String data) {
StringXmlApplicationContext context = new StringXmlApplicationContext(data);
String[] seqNames = context.getBeanNamesForType(GroupSequence.class);
sequences.clear();
for (String seqName : seqNames) {
GroupSequence seq = (GroupSequence) context.getBean(seqName);
sequences.put(seqName, seq);
}
}
示例2: buildRuleByStr
import com.taobao.tddl.rule.utils.StringXmlApplicationContext; //导入依赖的package包/类
/**
* 基于string字符流创建rule的spring容器
*
* @param data
* @return
*/
private ApplicationContext buildRuleByStr(String version, String data) {
if (compatibleOldRule) {
data = RuleCompatibleHelper.compatibleRule(data);
}
ApplicationContext applicationContext = new StringXmlApplicationContext(data, outerClassLoader);
ruleStrs.put(version, data); // 记录一下
return applicationContext;
}
示例3: testCompatible_interact
import com.taobao.tddl.rule.utils.StringXmlApplicationContext; //导入依赖的package包/类
@Test
public void testCompatible_interact() {
try {
Resource resource = new PathMatchingResourcePatternResolver().getResource("classpath:compatible/interact-spring-context.xml");
String ruleStr = StringUtils.join(IOUtils.readLines(resource.getInputStream()), SystemUtils.LINE_SEPARATOR);
ApplicationContext context = new StringXmlApplicationContext(RuleCompatibleHelper.compatibleRule(ruleStr));
VirtualTableRoot vtr1 = (VirtualTableRoot) context.getBean("vtabroot");
Assert.assertNotNull(vtr1);
} catch (IOException e) {
Assert.fail(ExceptionUtils.getFullStackTrace(e));
}
}
示例4: testCompatible_le
import com.taobao.tddl.rule.utils.StringXmlApplicationContext; //导入依赖的package包/类
@Test
public void testCompatible_le() {
try {
Resource resource = new PathMatchingResourcePatternResolver().getResource("classpath:compatible/le-spring-context.xml");
String ruleStr = StringUtils.join(IOUtils.readLines(resource.getInputStream()), SystemUtils.LINE_SEPARATOR);
ApplicationContext context = new StringXmlApplicationContext(RuleCompatibleHelper.compatibleRule(ruleStr));
VirtualTableRoot vtr1 = (VirtualTableRoot) context.getBean("vtabroot");
Assert.assertNotNull(vtr1);
} catch (IOException e) {
Assert.fail(ExceptionUtils.getFullStackTrace(e));
}
}