Optimizes isResolvable() only bind with correct prefix.

This commit is contained in:
spencergibb
2020-09-11 09:57:37 -04:00
parent 197ef69f6f
commit 59507ee8bc

View File

@@ -58,12 +58,16 @@ public class ConsulConfigDataLocationResolver
@Override
public boolean isResolvable(ConfigDataLocationResolverContext context,
String location) {
if (!location.startsWith(PREFIX)) {
return false;
}
// only bind if correct prefix
boolean enabled = context.getBinder()
.bind(ConsulProperties.PREFIX + ".enabled", Boolean.class).orElse(true);
boolean configEnabled = context.getBinder()
.bind(ConsulConfigProperties.PREFIX + ".enabled", Boolean.class)
.orElse(true);
return location.startsWith(PREFIX) && configEnabled && enabled;
return configEnabled && enabled;
}
@Override