Nested placeholder is not recursively resolved in case it has a default value of another placeholder. It used to work in Spring 6.1.9
How to reproduce:
-
Navigate to the parser test: https://github.com/spring-projects/spring-framework/blob/078d683f47b0e7d0b355562bfaf0382c020a1fd9/spring-core/src/test/java/org/springframework/util/PlaceholderParserTests.java#L212
-
add one more line to test:
Arguments.of("${p6:${p1}}", "v1:v2:def"),
- Expected value of
${p6:${p1}}
isv1:v2:def
, but actual is${p1}:${p2}:${bogus:def}
- the raw text value ofp6
.
How to fix:
- Modify this line of NestedPlaceholderPart to recursively resolve the value https://github.com/spring-projects/spring-framework/blob/078d683f47b0e7d0b355562bfaf0382c020a1fd9/spring-core/src/main/java/org/springframework/util/PlaceholderParser.java#L498
- The recursive resolution code is already there at the following line but it is used in SimplePlaceholderPart only: https://github.com/spring-projects/spring-framework/blob/078d683f47b0e7d0b355562bfaf0382c020a1fd9/spring-core/src/main/java/org/springframework/util/PlaceholderParser.java#L446
Comment From: snicoll
Thanks for the report. Someone created a PR for this that we will review.
Comment From: snicoll
@vip-delete thanks again for reporting the regression. This should be fixed in Spring Framework 6.2.1-SNAPSHOT
available shortly from repo.spring.io/snapshot.