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

兼容 catlog 为null

上级 a303fe2e
......@@ -5,7 +5,7 @@
<groupId>cn.zhangfusheng</groupId>
<artifactId>paoding-rose-jade</artifactId>
<packaging>jar</packaging>
<version>1.0.3</version>
<version>1.0.4</version>
<name>paoding-rose-jade</name>
<parent>
......
......@@ -28,11 +28,12 @@ public class SpringDataSourceFactoryDelegate implements DataSourceFactory {
Class<?> daoClass = metaData.getDAOMetaData().getDAOClass();
String catalog = daoClass.getAnnotation(DAO.class).catalog();
DataSourceFactory dataSourceFactory = null;
if (dataSourceFactoryMap.containsKey(catalog)) {
dataSourceFactory = dataSourceFactoryMap.get(catalog);
String key = daoClass.getName() + "-" + metaData.getSQLType();
if (dataSourceFactoryMap.containsKey(key)) {
dataSourceFactory = dataSourceFactoryMap.get(key);
} else {
String beanName = "jade.dataSourceFactory";
String catlogBeanName = StringUtils.isEmpty(catalog) ? null : beanName + "." + catalog;
String catlogBeanName = StringUtils.isEmpty(catalog) ? beanName : beanName + "." + catalog;
ListableBeanFactory beanFactory = this.beanFactory;
if (beanFactory != null) {
if (beanFactory.containsBeanDefinition(catlogBeanName)) {
......@@ -42,7 +43,7 @@ public class SpringDataSourceFactoryDelegate implements DataSourceFactory {
} else {
dataSourceFactory = new SpringDataSourceFactory(beanFactory);
}
dataSourceFactoryMap.put(catalog, dataSourceFactory);
dataSourceFactoryMap.put(key, dataSourceFactory);
}
}
assert dataSourceFactory != null;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册