-
Notifications
You must be signed in to change notification settings - Fork 40.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multi-Document-Separators "#---" comment checks do not account for '!' prefixed comments #32185
Comments
Some history about why we added this restriction can be found in #22963. If we remove it then we're likely to break folks that have comments such as:
In this example, the user doesn't want
I think the existing code only considers
|
Using Spring Boot 2.7.3. The docs for Spring Boot 2.7.3 say on https://docs.spring.io/spring-boot/docs/2.7.3/reference/htmlsingle/#features.external-config.files.multi-document
Using IDEs like IntelliJ, often, blank lines get removed. It is a setting for "Code Style" on "properties" files.
When the IDE removed a blank line, it happened. A comment from the line above got directly placed in front of the document separator line containing "#---".
Like this, the multi document was not recognized anymore and led to problems like a misconfiguration of the application.
Sure, we will activate the Code Style Feature "Keep blank lines" for "properties", but still... Since comments should be perfectly fine in a property-file, it feels like a parser bug that it isn't allowed to have a comment line in front of and after the "#---" line.
Please make it valid to have a multi-document like the following:
With 2.7.3, when we did not activate the "testing" profile, myProp=abcdef was set. Ouch.
At the very moment, only the following works correctly:
To add a little more of an info..
I think the problem might be in here: https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/env/OriginTrackedPropertiesLoader.java
The text was updated successfully, but these errors were encountered: