diff --git a/ribbon-core/src/main/java/com/netflix/client/config/ClientConfigFactory.java b/ribbon-core/src/main/java/com/netflix/client/config/ClientConfigFactory.java index f6e8b908..aed2e50a 100644 --- a/ribbon-core/src/main/java/com/netflix/client/config/ClientConfigFactory.java +++ b/ribbon-core/src/main/java/com/netflix/client/config/ClientConfigFactory.java @@ -34,7 +34,8 @@ static ClientConfigFactory findDefaultConfigFactory() { return StreamSupport.stream(ServiceLoader.load(ClientConfigFactory.class).spliterator(), false) .sorted(Comparator .comparingInt(ClientConfigFactory::getPriority) - .thenComparing(Comparator.comparing(f -> f.getClass().getCanonicalName()))) + .thenComparing(f -> f.getClass().getCanonicalName()) + .reversed()) .findFirst() .orElseGet(() -> { throw new IllegalStateException("Expecting at least one implementation of ClientConfigFactory discoverable via the ServiceLoader"); diff --git a/ribbon-core/src/main/java/com/netflix/client/config/ReloadableClientConfig.java b/ribbon-core/src/main/java/com/netflix/client/config/ReloadableClientConfig.java index e53ecd82..38229a22 100644 --- a/ribbon-core/src/main/java/com/netflix/client/config/ReloadableClientConfig.java +++ b/ribbon-core/src/main/java/com/netflix/client/config/ReloadableClientConfig.java @@ -389,15 +389,13 @@ public final T get(IClientConfigKey key, T defaultValue) { public final IClientConfig set(IClientConfigKey key, T value) { Preconditions.checkArgument(key != null, "key cannot be null"); - // Make sure the value is property typed + // Make sure the value is property typed. value = resolveValueToType(key, value); - // If a client is already specified then check if there's a dynamic config override available - if (isLoaded) { - value = resolveFinalProperty(key).orElse(value); - } + // Check if there's a dynamic config override available + value = resolveFinalProperty(key).orElse(value); - // Cache this new state + // Cache the new value internalProperties.put(key, Optional.ofNullable(value)); // If this is the first time a property is seen and a client name has been specified then make sure