Restore support of exact match property

This commit fixes a regression in property placeholder resolution where
the original key was no longer considered for an exact match before
processing the placeholder itself.

By default, property resolution uses ':' as the separator between the
key and the fallback value.

Consider a request to resolve ${prefix://service}. Previously,
placeholder resolution would first attempt to resolve the raw text, that
is 'prefix://service', before attempting to resolve the 'prefix' key and
then use '//service' if the key did not resolve.

This commit restores that behaviour purely for backward compatible
reason.

Closes gh-34124
This commit is contained in:
Stéphane Nicoll
2024-12-23 12:13:24 +01:00
parent ebae02a92b
commit 5ce5647d09
2 changed files with 43 additions and 4 deletions

View File

@@ -519,7 +519,7 @@ final class PlaceholderParser {
@Override
public String resolve(PartResolutionContext resolutionContext) {
String value = resolveRecursively(resolutionContext, this.key);
String value = resolveRecursively(resolutionContext);
if (value != null) {
return value;
}
@@ -528,6 +528,17 @@ final class PlaceholderParser {
}
return resolutionContext.handleUnresolvablePlaceholder(this.key, text());
}
@Nullable
private String resolveRecursively(PartResolutionContext resolutionContext) {
if (!this.text().equals(this.key)) {
String value = resolveRecursively(resolutionContext, this.text());
if (value != null) {
return value;
}
}
return resolveRecursively(resolutionContext, this.key);
}
}