diff --git a/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java b/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java index b00d55e4..f0559ede 100644 --- a/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java +++ b/spring-cloud-config-client/src/main/java/org/springframework/cloud/config/client/ConfigServicePropertySourceLocator.java @@ -85,12 +85,14 @@ public class ConfigServicePropertySourceLocator implements PropertySourceLocator result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()), result.getLabel(), result.getVersion())); - for (PropertySource source : result.getPropertySources()) { - @SuppressWarnings("unchecked") - Map map = (Map) source - .getSource(); - composite.addPropertySource(new MapPropertySource(source - .getName(), map)); + if (result.getPropertySources() != null) { // result.getPropertySources() can be null if using xml + for (PropertySource source : result.getPropertySources()) { + @SuppressWarnings("unchecked") + Map map = (Map) source + .getSource(); + composite.addPropertySource(new MapPropertySource(source + .getName(), map)); + } } return composite; }