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

修改 bean 的获取

上级 2c268a29
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
<groupId>cn.zhangfusheng</groupId> <groupId>cn.zhangfusheng</groupId>
<artifactId>paoding-rose-jade</artifactId> <artifactId>paoding-rose-jade</artifactId>
<packaging>jar</packaging> <packaging>jar</packaging>
<version>2.0.4</version> <version>2.0.5</version>
<name>paoding-rose-jade</name> <name>paoding-rose-jade</name>
<parent> <parent>
......
...@@ -36,13 +36,14 @@ public class SpringDataSourceFactoryDelegate implements DataSourceFactory { ...@@ -36,13 +36,14 @@ public class SpringDataSourceFactoryDelegate implements DataSourceFactory {
String catlogBeanName = StringUtils.isEmpty(catalog) ? beanName : beanName + "." + catalog; String catlogBeanName = StringUtils.isEmpty(catalog) ? beanName : beanName + "." + catalog;
ListableBeanFactory beanFactory = this.beanFactory; ListableBeanFactory beanFactory = this.beanFactory;
if (beanFactory != null) { if (beanFactory != null) {
if (beanFactory.containsBeanDefinition(catlogBeanName)) { if (beanFactory.containsBeanDefinition(catlogBeanName) || beanFactory.containsBean(catlogBeanName)) {
dataSourceFactory = beanFactory.getBean(catlogBeanName, DataSourceFactory.class); dataSourceFactory = beanFactory.getBean(catlogBeanName, DataSourceFactory.class);
} else if (beanFactory.containsBeanDefinition(beanName)) { } else if (beanFactory.containsBeanDefinition(beanName) || beanFactory.containsBean(beanName)) {
dataSourceFactory = beanFactory.getBean(beanName, DataSourceFactory.class); dataSourceFactory = beanFactory.getBean(beanName, DataSourceFactory.class);
} else { } else {
dataSourceFactory = new SpringDataSourceFactory(beanFactory); dataSourceFactory = new SpringDataSourceFactory(beanFactory);
} }
assert dataSourceFactory != null;
dataSourceFactoryMap.put(key, dataSourceFactory); dataSourceFactoryMap.put(key, dataSourceFactory);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册