-1

Requirement: I have to update .properties or .yml file. Which is in parent module. I have created spring boot custom library to get values from parent .properties or .yml and communicate to third service to get Json data. That contain password. This password I have to update to properties file.

Our application not supporting spring-cloud. Reason for going custom library

From parent application
datasource:
     url: jdbc:postgresql:URL
     username: CURRENTUSER
     password: CURRENT

Now i have to update property say 'datasoucrce.password=CURRENT' to 'datasoucrce.password=UPDATEDPASSWORD' in custom library.

From Custom Library application
    datasource:
         url: jdbc:postgresql:URL
         username: UPDATEDUSER
         password: UPDATEDPASSWORD

I have only one .yml file. But I have to update inherited datasoucrce.password="CURRENT" to datasoucrce.password="UPDATEDPASSWORD" This UPDATEDPASSWORD (value). I am getting from API call Any help?

Rajesh Sharma
  • 59
  • 1
  • 11
  • is the indentation different in the two files? because the indentation in your code is not the same and that may have an effect in yaml – JoSSte Jul 06 '23 at 11:42
  • I have only one .yml file. But I have to update inherted ```datasoucrce.password="CURRENT"``` to ```datasoucrce.password="UPDATEDPASSWORD"``` This UPDATEDPASSWORD (value). I am getting from 1 service call. Hope now my question it clear – Rajesh Sharma Jul 06 '23 at 12:05

1 Answers1

0

The YML format is XML based and looks completely different from the YAML format.

But you don't even have the latter as both documents will not load as you cannot have a multiline plain (i.e. unquoted) scalar be the key of a mapping entry.

Even if the first line of you documents is commented out, you would still not have datasoucrce as key of the root level mapping you would get after loading, but datasource.

Anthon
  • 69,918
  • 32
  • 186
  • 246