Skip to content

Commit a9aa8f4

Browse files
committed
removes options for boot 2.4 since 3.1.x requires boot 2.6
1 parent 7950cac commit a9aa8f4

File tree

1 file changed

+10
-23
lines changed

1 file changed

+10
-23
lines changed

spring-cloud-zookeeper-config/src/main/java/org/springframework/cloud/zookeeper/config/ZookeeperConfigDataLoader.java

Lines changed: 10 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import java.util.ArrayList;
2020
import java.util.Collections;
21-
import java.util.EnumSet;
2221
import java.util.List;
2322

2423
import org.apache.commons.logging.Log;
@@ -31,7 +30,6 @@
3130
import org.springframework.util.StringUtils;
3231

3332
public class ZookeeperConfigDataLoader implements ConfigDataLoader<ZookeeperConfigDataResource> {
34-
private static final EnumSet<ConfigData.Option> ALL_OPTIONS = EnumSet.allOf(ConfigData.Option.class);
3533

3634
private final Log log;
3735

@@ -50,35 +48,24 @@ public ConfigData load(ConfigDataLoaderContext context, ZookeeperConfigDataResou
5048
ZookeeperPropertySource propertySource = new ZookeeperPropertySource(resource.getContext(),
5149
curator);
5250
List<ZookeeperPropertySource> propertySources = Collections.singletonList(propertySource);
53-
if (ALL_OPTIONS.size() == 1) {
54-
// boot 2.4.2 and prior
55-
return new ConfigData(propertySources);
56-
}
57-
else if (ALL_OPTIONS.size() == 2) {
58-
// boot 2.4.3 and 2.4.4
59-
return new ConfigData(propertySources, ConfigData.Option.IGNORE_IMPORTS, ConfigData.Option.IGNORE_PROFILES);
60-
}
61-
else if (ALL_OPTIONS.size() > 2) {
62-
// boot 2.4.5+
63-
return new ConfigData(propertySources, source -> {
64-
List<ConfigData.Option> options = new ArrayList<>();
65-
options.add(ConfigData.Option.IGNORE_IMPORTS);
66-
options.add(ConfigData.Option.IGNORE_PROFILES);
67-
if (StringUtils.hasText(resource.getProfile())) {
68-
options.add(ConfigData.Option.PROFILE_SPECIFIC);
69-
}
70-
return ConfigData.Options.of(options.toArray(new ConfigData.Option[0]));
71-
});
7251

73-
}
52+
return new ConfigData(propertySources, source -> {
53+
List<ConfigData.Option> options = new ArrayList<>();
54+
options.add(ConfigData.Option.IGNORE_IMPORTS);
55+
options.add(ConfigData.Option.IGNORE_PROFILES);
56+
if (StringUtils.hasText(resource.getProfile())) {
57+
options.add(ConfigData.Option.PROFILE_SPECIFIC);
58+
}
59+
return ConfigData.Options.of(options.toArray(new ConfigData.Option[0]));
60+
});
61+
7462
}
7563
catch (Exception e) {
7664
if (log.isDebugEnabled()) {
7765
log.debug("Error getting properties from zookeeper: " + resource, e);
7866
}
7967
throw new ConfigDataResourceNotFoundException(resource, e);
8068
}
81-
return null;
8269
}
8370

8471
}

0 commit comments

Comments
 (0)