Merge branch '3.0.x'
This commit is contained in:
@@ -43,6 +43,10 @@ public class ZookeeperConfigDataLoader implements ConfigDataLoader<ZookeeperConf
|
||||
public ConfigData load(ConfigDataLoaderContext context, ZookeeperConfigDataResource resource) {
|
||||
try {
|
||||
CuratorFramework curator = context.getBootstrapContext().get(CuratorFramework.class);
|
||||
if (curator == null) {
|
||||
// this can happen if certain conditions are met
|
||||
return null;
|
||||
}
|
||||
ZookeeperPropertySource propertySource = new ZookeeperPropertySource(resource.getContext(),
|
||||
curator);
|
||||
List<ZookeeperPropertySource> propertySources = Collections.singletonList(propertySource);
|
||||
@@ -70,7 +74,7 @@ public class ZookeeperConfigDataLoader implements ConfigDataLoader<ZookeeperConf
|
||||
}
|
||||
catch (Exception e) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Error getting properties from consul: " + resource, e);
|
||||
log.debug("Error getting properties from zookeeper: " + resource, e);
|
||||
}
|
||||
throw new ConfigDataResourceNotFoundException(resource, e);
|
||||
}
|
||||
|
||||
@@ -117,8 +117,10 @@ public abstract class CuratorFactory {
|
||||
BootstrapContext context = event.getBootstrapContext();
|
||||
if (predicate.test(context)) {
|
||||
CuratorFramework curatorFramework = context.get(CuratorFramework.class);
|
||||
event.getApplicationContext().getBeanFactory().registerSingleton("configDataCuratorFramework",
|
||||
curatorFramework);
|
||||
if (!event.getApplicationContext().getBeanFactory().containsBean("configDataCuratorFramework")) {
|
||||
event.getApplicationContext().getBeanFactory().registerSingleton("configDataCuratorFramework",
|
||||
curatorFramework);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user