From aef26985c9bead2d5be21224dd4ca27a2956ddfd Mon Sep 17 00:00:00 2001 From: erabii Date: Thu, 12 Aug 2021 07:19:47 -0400 Subject: [PATCH] reverting an ommited commit (#850) --- .../commons/config/ConfigMapPropertySourceLocator.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java index 99da08c2..46d69aea 100644 --- a/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java +++ b/spring-cloud-kubernetes-commons/src/main/java/org/springframework/cloud/kubernetes/commons/config/ConfigMapPropertySourceLocator.java @@ -20,8 +20,9 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Paths; import java.util.HashMap; -import java.util.List; +import java.util.LinkedHashSet; import java.util.Map; +import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -67,7 +68,7 @@ public abstract class ConfigMapPropertySourceLocator implements PropertySourceLo CompositePropertySource composite = new CompositePropertySource("composite-configmap"); if (this.properties.isEnableApi()) { - List sources = this.properties.determineSources(); + Set sources = new LinkedHashSet<>(this.properties.determineSources()); LOG.debug("Config Map normalized sources : " + sources); sources.forEach(s -> composite.addFirstPropertySource(getMapPropertySourceForSingleConfigMap(env, s))); } @@ -88,7 +89,8 @@ public abstract class ConfigMapPropertySourceLocator implements PropertySourceLo } private void addPropertySourcesFromPaths(Environment environment, CompositePropertySource composite) { - properties.getPaths().stream().map(Paths::get).filter(p -> { + Set uniquePaths = new LinkedHashSet<>(properties.getPaths()); + uniquePaths.stream().map(Paths::get).filter(p -> { boolean exists = Files.exists(p); if (!exists) { LOG.warn("Configured input path: " + p