Add support for Spring Boot multi-document properties files
See original GitHub issueSpring Boot 2.4 will add support for multi-document .properties
files. These behave in a similar way to multi-document YAML files and allow the user to split a physical .properties
file into multiple independent logical documents. With properties #---
is used as the separator. The reference documentation has an updated section that covers the new syntax.
The new format may cause a few problem with the IDE editor. Specifically, you can get errors about duplicate keys. It would be nice if the IDE could treat each logical section as a different document and not present those warnings. If you’re interested in some Java code that parses the new format, you can look at OriginTrackedPropertiesLoader.java from the Spring Boot codebase.
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (12 by maintainers)
Top Results From Across the Web
Config file processing in Spring Boot 2.4
With Spring Boot 2.4, we've decided to bring YAML-like multi-document support to Java properties files. Multi-document properties files use ...
Read more >Add support for Spring Boot multi-document properties files
Spring Boot 2.4 will add support for multi-document .properties files. These behave in a similar way to multi-document YAML files and allow the...
Read more >Properties with Spring and Spring Boot - Baeldung
This comes in handy when we have multiple sources of configuration properties. Since version 2.4.0, Spring Boot supports using multi-document ...
Read more >Multi document properties file support in Spring
From spring boot 2.4.0 onwards, spring start supporting multi document properties file. Using this feature, we can split a single property file ......
Read more >Spring boot 2.4.x cannot handle multi document yml files from ...
yml : general datasource properties; my-rest-sercive.yml : specific datasource url for dev. I can see these 4 sources successfully being fetched ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Correct.
Sounds interesting. I have to admit I didn’t fully understand what you are suggesting / have in mind. But it sounds like if we discussed a bit… we could come up with something interesting to implement 😃. It would be great if you create a ticket for these kinds of enhancements.
Also thanks Phil for explaining some of the reasoning behind the decision. I understand it is a tradeof, naturally I was more concerned about the tooling impact and not as in tune with other considerations. All in all I think the tooling impact won’t be as bad. So I agree you probably made the right decision. My initial misgivings were overblown since I verified already that neither vanilla Eclipse nor vscode produces warnings about duplicate keys. So it’s just coming from STS and therefore it is under our control.
Step 1 would be a simple fix to just disable those warnings when we detect the document marker is present. That would be a trivial fix. But it wouldn’t be ideal.
Step 2 would be to make the editor truly aware of it’s multi-document stucture (i.e as in the yaml editor). This is likely a bit more involved. I haven’t a good idea yet how much work it would/will be and how important it is, but it should be feasible.
(comment in Pivotal Tracker added by Nieraj Singh:)
Multi-doc support in properties file seems to work. See attached screenshot