提交 e5ad4bbb 编写于 作者: 菜鸟阿达's avatar 菜鸟阿达

数据库主从复制 支持一下 catalog

上级 0b8be434
......@@ -31,15 +31,18 @@ public class SpringDataSourceFactoryDelegate implements DataSourceFactory {
if (dataSourceFactoryMap.containsKey(catalog)) {
dataSourceFactory = dataSourceFactoryMap.get(catalog);
} else {
String beanName = StringUtils.isEmpty(catalog) ? "jade.dataSourceFactory" : "jade.dataSourceFactory." + catalog;
String beanName = "jade.dataSourceFactory";
String catlogBeanName = StringUtils.isEmpty(catalog) ? null : beanName + "." + catalog;
ListableBeanFactory beanFactory = this.beanFactory;
if (beanFactory != null) {
if (beanFactory.containsBeanDefinition(beanName)) {
if (beanFactory.containsBeanDefinition(catlogBeanName)) {
dataSourceFactory = beanFactory.getBean(catlogBeanName, DataSourceFactory.class);
} else if (beanFactory.containsBeanDefinition(beanName)) {
dataSourceFactory = beanFactory.getBean(beanName, DataSourceFactory.class);
} else {
dataSourceFactory = new SpringDataSourceFactory(beanFactory);
}
dataSourceFactoryMap.put(beanName, dataSourceFactory);
dataSourceFactoryMap.put(catalog, dataSourceFactory);
}
}
assert dataSourceFactory != null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册