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 c88df267..2eef9879 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 @@ -96,12 +96,14 @@ public class ConfigServicePropertySourceLocator implements PropertySourceLocator result.getProfiles() == null ? "" : Arrays.asList(result.getProfiles()), result.getLabel(), result.getVersion(), result.getState())); - 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)); + } } if (StringUtils.hasText(result.getState()) || StringUtils.hasText(result.getVersion())) {