question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add support for Spring Boot multi-document properties files

See original GitHub issue

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 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:closed
  • Created 3 years ago
  • Comments:13 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
kdvoldercommented, Sep 14, 2020

I’ve not seen any problems with the YAML editor. The YAML spec has always supported multiple documents so you probably already deal with them.

Correct.

Yeah, there’s also support for importing configs using spring.config.import. …

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.

0reactions
spring-projects-issuescommented, Sep 26, 2020

(comment in Pivotal Tracker added by Nieraj Singh:)

Multi-doc support in properties file seems to work. See attached screenshot

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found