diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataLocationResolver.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataLocationResolver.java index f21970c391..c6ca85e671 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataLocationResolver.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/StandardConfigDataLocationResolver.java @@ -26,6 +26,7 @@ import java.util.List; import java.util.Set; import java.util.regex.Matcher; import java.util.regex.Pattern; +import java.io.File; import org.apache.commons.logging.Log; @@ -212,7 +213,7 @@ public class StandardConfigDataLocationResolver } } throw new IllegalStateException("File extension is not known to any PropertySourceLoader. " - + "If the location is meant to reference a directory, it must end in '/'"); + + "If the location is meant to reference a directory, it must end in '/' or File.separator"); } private String getLoadableFileExtension(PropertySourceLoader loader, String file) { @@ -225,7 +226,7 @@ public class StandardConfigDataLocationResolver } private boolean isDirectory(String resourceLocation) { - return resourceLocation.endsWith("/"); + return resourceLocation.endsWith("/") || resourceLocation.endsWith(File.separator); } private List resolve(Set references) {