Hello,

I get error bellow when properties file's first line is # (empty comment). If first line comment has more characters there is no error.

Error creating bean with name 'demoApplication': Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'message' in value "${message}"

exception occurs while application.properties file look like:

#
message=Hello
#

spring-boot version 2.4.0

Comment From: neaplus

additionally, i can confirm that it affects each property line next to single # line (empty comment line).

Comment From: knoobie

Issue is already fixed. You can find more infos here https://github.com/spring-projects/spring-boot/issues/24158.

Comment From: snicoll

Thank you @knoobie.

@neaplus please give 2.4.1-SNAPSHOT a try if you can to confirm this fixes your use case as well.

Comment From: neaplus

@snicoll, I hereby confirm working perfectly at 2.4.1-SNAPSHOT. Thanks all.