codeconsole commented on code in PR #16732:
URL: https://github.com/apache/grails-core/pull/16732#discussion_r4371470156
##########
grails-core/src/main/groovy/org/grails/config/NavigableMapConfig.java:
##########
@@ -55,13 +59,14 @@ public abstract class NavigableMapConfig implements Config {
protected static final Logger LOG =
LoggerFactory.getLogger(NavigableMapConfig.class);
protected ClassLoader classLoader =
Thread.currentThread().getContextClassLoader();
protected ConfigurableConversionService conversionService = new
DefaultConversionService();
+ private volatile SystemEnvironmentIndex systemEnvironment = new
SystemEnvironmentIndex(System.getenv());
protected NavigableMap configMap = new NavigableMap() {
@Override
- protected Object mergeMapEntry(NavigableMap targetMap, String
sourceKey, Object newValue) {
- if (newValue instanceof CharSequence) {
- newValue = resolvePlaceholders(newValue.toString());
+ protected Object mergedValue(Object value) {
Review Comment:
Fixed in 4c627eb9a3. The config resolves placeholders through the value hook
a merge applies to what it stores, and before 7e9b4c22d0 the element keys the
config re-merged were what carried each element of a YAML list through that
hook; with them gone, a list merged as a value was stored as it was and its
elements were never walked, so `app.rows[0].name` and the list held the literal
`${NAME:row}`. The hook now applies to each element of a list and each entry of
a plain map a merge stores, recursively and in place, so a placeholder inside
an element is resolved as one in an entry of a block is, and both
representations hold the one result. A container that refuses the write, a list
`application.groovy` built with `asImmutable()`, is replaced by a copy that
holds the resolved elements; a list whose elements are stored as they are is
left as the same object.
Pinned with your YAML in `YamlPropertySourceLoaderSpec`, `app.rows: [{name:
'${NAME:row}', tags: ['${TAG:t}'], owner: '${app.name}'}]`, asserting `row`,
`t` and `demo` through `getProperty('app.rows[0].name')`, the indexed keys
below it, `getProperty('app.rows', List)` and `navigate`, and the environment's
own resolution beside it; in `PropertySourcesConfigSpec` for the same
containers merged as values and for an immutable list in a property source,
where the config holds a resolved copy and the source keeps its list; in
`GrailsAppGroovyConfigSpec` for a placeholder in an `application.groovy` list
read through the config and the environment of a started `GrailsApp`; and in
`NavigableMapSpec` for the hook itself over a list, a list inside a list, an
element map and an immutable list.
--
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]