diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoader.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoader.java index 254a02a021..29c93da157 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoader.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/config/ConfigTreeConfigDataLoader.java @@ -21,6 +21,7 @@ import java.nio.file.Path; import java.util.Collections; import org.springframework.boot.env.ConfigTreePropertySource; +import org.springframework.boot.env.ConfigTreePropertySource.Option; /** * {@link ConfigDataLoader} for config tree locations. @@ -37,7 +38,7 @@ public class ConfigTreeConfigDataLoader implements ConfigDataLoader imp /** * Convert file and directory names to lowercase. */ - USE_LOWERCASE_NAMES + USE_LOWERCASE_NAMES, + + /** + * Automatically attempt trim trailing new-line characters. + */ + AUTO_TRIM_TRAILING_NEW_LINE } @@ -173,17 +178,22 @@ public class ConfigTreePropertySource extends EnumerablePropertySource imp private final PropertyFileContent cachedContent; + private final boolean autoTrimTrailingNewLine; + private PropertyFile(Path path, Set