codeconsole commented on PR #16732:
URL: https://github.com/apache/grails-core/pull/16732#issuecomment-6505035990

   @sbglasius, thanks for the review. Your points, at the current head:
   
   **1. A lower-precedence source can now answer the key.** Described in the 
upgrade guide and the `grails-9-upgrade` skill in 07a31f2ec3. The guide section 
is now §21, since #16760's encoding-filter section took §20. 
`PropertySourcesConfigSpec` pins it with `a.b: x` in a higher 
`MapPropertySource` and `a.b.c: y` in a lower one: `getProperty('a.b.c')` is 
`y`, `containsProperty` is `true`, and `navigate('a', 'b', 'c')` is `null`. A 
`StandardEnvironment` over the same two sources answers `y` too. The feature 
fails on 9.0.x.
   
   **2. The silent typed read.** Also in 07a31f2ec3. The section and the skill 
show `x.y: false` with `getProperty('x.y.enabled', Boolean, true)` (Grails 8: 
`false`, Grails 9: `true`), and the skill's checklist has the entry you asked 
for: no typed read with a default names a key below a configuration value that 
is not a map. A feature in `PropertySourcesConfigSpec` pins the read.
   
   **On `server.ports.0`.** This went the other way from your suggestion. 
jdaugherty agreed to read it as an index, as Spring Boot does, and that is in 
08c7f0543f, with the guide and skill in 1d08fa3fc3. Your compatibility point 
holds for a split across two PRs. Done here, Grails 9 never answers `null` for 
an index, so there is nothing to walk back.
   
   `navigate` indexes too, as you said it would have to, so the two lookups 
agree:
   - `server.ports.0` and `navigate('server', 'ports', '0')` are `8080`.
   - An index past the end, a signed number, or any other segment after a list 
stays absent.
   - A map whose keys are numbers reads as before.
   
   On the guide recommending `server.ports[0]`: that spelling only named the 
element for a list from `application.yml` or `.properties`, which write indexed 
keys. For a list from `application.groovy` it was `null`. With the index read 
it now answers for every list. `PropertySourcesConfigSpec` checks both kinds of 
list against a `StandardEnvironment` with `ConfigurationPropertySources` 
attached.
   


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

Reply via email to