Restore nested property resolution for non CharSequence types

Closes gh-33727

Co-authored-by: Andy Wilkinson <andy.wilkinson@broadcom.com>
This commit is contained in:
Stéphane Nicoll
2024-10-17 10:22:08 +02:00
parent cbdfe815aa
commit bdf76b2f8d
2 changed files with 16 additions and 4 deletions

View File

@@ -84,10 +84,14 @@ public class PropertySourcesPropertyResolver extends AbstractPropertyResolver {
}
Object value = propertySource.getProperty(key);
if (value != null) {
if (resolveNestedPlaceholders &&
(String.class.equals(targetValueType) || CharSequence.class.equals(targetValueType)) &&
value instanceof CharSequence cs) {
value = resolveNestedPlaceholders(cs.toString());
if (resolveNestedPlaceholders) {
if (value instanceof String string) {
value = resolveNestedPlaceholders(string);
}
else if ((value instanceof CharSequence cs) && (String.class.equals(targetValueType) ||
CharSequence.class.equals(targetValueType))) {
value = resolveNestedPlaceholders(cs.toString());
}
}
logKeyFound(key, propertySource, value);
return convertValueIfNecessary(value, targetValueType);