codeconsole opened a new pull request, #16770:
URL: https://github.com/apache/grails-core/pull/16770
A merge writes each nested value twice: as an entry of the nested map,
through the hook with which the configuration resolves placeholders, and as a
flat dotted key at the root, which kept the raw value:
```groovy
def config = new PropertySourcesConfig(new MapPropertySource('env', [host:
'example.com']))
config.merge([app: [url: 'http://${host}']])
config.navigate('app', 'url') // 'http://example.com'
config['app.url'] // was 'http://${host}', now
'http://example.com'
config.toProperties().getProperty('app.url') // now 'http://example.com'
```
The flat key now holds the value the nested entry holds, as the hook stored
it, so the placeholder is resolved once for both, a value such as
`${random.uuid}` is the same in both, and nothing is written into the map that
was merged. `PropertySourcesConfigSpec` checks the dotted key, the nested map
and the export against a property source that answers a new value each time it
is read, so a second resolution would show.
Found while working on #16732; the bug is the same on every branch from
7.0.x to 9.0.x.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]