diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java index 19775ab817..c6632c4545 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/source/SystemEnvironmentPropertyMapper.java @@ -118,7 +118,9 @@ final class SystemEnvironmentPropertyMapper implements PropertyMapper { } StringBuilder legacyCompatibleName = new StringBuilder(); for (int i = 0; i < name.getNumberOfElements(); i++) { - legacyCompatibleName.append((i != 0) ? '.' : ""); + if (i != 0) { + legacyCompatibleName.append('.'); + } legacyCompatibleName.append(name.getElement(i, Form.DASHED).replace('-', '.')); } return ConfigurationPropertyName.isValid(legacyCompatibleName)