From d355b2bc57389e7ec754f6becd43f5a1bc79aafe Mon Sep 17 00:00:00 2001
From: "fusheng.zhang" <17610759700@163.com>
Date: Tue, 24 Mar 2020 17:14:42 +0800
Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=20catlog=20=E4=B8=BAnull?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
pom.xml | 2 +-
.../context/spring/SpringDataSourceFactoryDelegate.java | 9 +++++----
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/pom.xml b/pom.xml
index 950da2e..258fffd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -5,7 +5,7 @@
cn.zhangfusheng
paoding-rose-jade
jar
- 1.0.3
+ 1.0.4
paoding-rose-jade
diff --git a/src/main/java/net/paoding/rose/jade/context/spring/SpringDataSourceFactoryDelegate.java b/src/main/java/net/paoding/rose/jade/context/spring/SpringDataSourceFactoryDelegate.java
index a606f3f..21c180d 100644
--- a/src/main/java/net/paoding/rose/jade/context/spring/SpringDataSourceFactoryDelegate.java
+++ b/src/main/java/net/paoding/rose/jade/context/spring/SpringDataSourceFactoryDelegate.java
@@ -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;
--
GitLab