This is a reopen of #1413 which unfortunately I hadn't have time to try to reproduce in the latest version at the time.
In spring boot 2.2.5-RELEASE and spring-cloud-config-server 2.2.2-RELEASE, if a YAML property value is quoted and referenced through a placeholder, the quotes are not preserved after the config server performs placeholders resolution. For example
key1:
key11: 'value1:'
key12: ${key1.key11}
becomes after resolution
key1:
key11: 'value1:'
key12: value1:
while one would expect
key1:
key11: 'value1:'
key12: 'value1:'
Comment From: spencergibb
Aren't quotes part of the yaml spec? Does this only happen with config server or does it happen with just spring boot too?
Comment From: tnaskali
In my knowledge spring boot's placeholder resolution only happens at runtime, so the situation where the yaml becomes invalid after resolution (like here with the trailing colon) doesn't happen as at that time it simply isn't yaml anymore. So I think it only happens with config server where one or many yaml files are transformed into another yaml file using placeholder resolution.
Comment From: spencergibb
I still don't see how this is specific to config server. The value of the quoted value in the spring environment won't have the quotes.
Comment From: tnaskali
so I understand that this is the expected behaviour, then either I'm doing something wrong in my YAML code or the feature is just too dangerous to use and these special cases should be well documented. Assuming we're in the first case scenario, what would be the proper way to write the example YAML code to avoid rendering an illegal YAML file ? I've tried the following and none of them works :
key1:
key12: ${key1.key11}
key13: "${key1.key11}"
key14: '${key1.key11}'
The only workaround I found is to avoid placeholder resolution either by configuration or by escaping the initial dollar sign :
key1:
key15: \${key1.key11}
Comment From: spencergibb
I'm at a loss as to what to say
Comment From: tnaskali
Would you care to indicate what kind of feedback you still need from me ? Isn't my example explicit enough ? Can't it be reproduced ? Or isn't it relevant ?
Comment From: spencergibb
Sorry for the delay. The quotes are gone at the spring boot API level. There's nothing we can do on the spring cloud side.