Spring-boot: properties file can not loaded, if file begins (#) empty comment line

Created on 21 Nov 2020  路  4Comments  路  Source: spring-projects/spring-boot

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

duplicate

Most helpful comment

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

All 4 comments

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

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

Thank you @knoobie.

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

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

Was this page helpful?
0 / 5 - 0 ratings