jdaugherty commented on code in PR #16547:
URL: https://github.com/apache/grails-core/pull/16547#discussion_r4210770052
##########
grails-core/src/main/groovy/org/grails/config/yaml/YamlPropertySourceLoader.java:
##########
@@ -58,9 +61,17 @@ public List<PropertySource<?>> load(String name, Resource
resource) throws IOExc
public List<PropertySource<?>> load(String name, Resource resource,
List<String> filteredKeys) throws IOException {
setResources(resource);
+ // Select source documents once; merging resolved configuration must
not re-evaluate JVM profiles.
+ final List<String> activeProfiles = Arrays.asList(
+
StringUtils.tokenizeToStringArray(System.getProperty("spring.profiles.active",
""), ","));
setDocumentMatchers((DocumentMatcher) properties -> {
- final String profile = properties.getProperty("spring.profiles");
- return profile == null ||
profile.equalsIgnoreCase(System.getProperty("spring.profiles.active")) ?
MatchStatus.FOUND : MatchStatus.NOT_FOUND;
+ final String profile =
properties.getProperty("spring.config.activate.on-profile", "").trim();
Review Comment:
Fixed in a643247dd2. The matcher now collects the indexed entries (`key[0]`,
`key[1]`, ...) alongside the scalar value for both
`spring.config.activate.on-profile` and `spring.profiles`, and treats them as
alternatives, matching Spring Boot's `String[]` binding. Each entry may be a
profile expression; blank entries are ignored, so a sequence restricts the
document unless every entry is blank. Unrelated indexed keys such as
`spring.profiles.include[0]` are not treated as selectors.
Tests in `YamlSpringProfileSpec` cover flow and block sequences for both
selectors in dotted and nested form (including your `[alpha, beta]` with only
`gamma` active), case sensitivity, a sequence combined with a scalar selector,
and an invalid expression inside a sequence. `ExternalConfigSpec` adds a
`grails.config.locations` case. The new rows fail against the previous loader.
The guide now documents sequence selectors.
--
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]