Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NestedPlaceholder are not recursively resolved if the fallback is a placeholder #34020

Closed
vip-delete opened this issue Dec 4, 2024 · 2 comments
Assignees
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Milestone

Comments

@vip-delete
Copy link

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:

  1. Navigate to the parser test:

  2. add one more line to test:

Arguments.of("${p6:${p1}}", "v1:v2:def"),
  1. Expected value of ${p6:${p1}} is v1:v2:def, but actual is ${p1}:${p2}:${bogus:def} - the raw text value of p6.

How to fix:

  1. Modify this line of NestedPlaceholderPart to recursively resolve the value
    String value = resolutionContext.resolvePlaceholder(resolvedKey);
  2. The recursive resolution code is already there at the following line but it is used in SimplePlaceholderPart only:
    String resolvedValue = resolveToText(resolutionContext, this.key);
@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged or decided on label Dec 4, 2024
abdelmawla56 added a commit to abdelmawla56/spring-framework that referenced this issue Dec 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
i have solved the NestedPlaceholderPart does not recursively resolve placeholders spring-projects#34020 issue
abdelmawla56 added a commit to abdelmawla56/spring-framework that referenced this issue Dec 4, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
this is the tests of my editing on 
NestedPlaceholderPart placeholders spring-projects#34020
@vip-delete 
@spring-projects
@snicoll
Copy link
Member

snicoll commented Dec 4, 2024

Thanks for the report. Someone created a PR for this that we will review.

@snicoll snicoll added in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression and removed status: waiting-for-triage An issue we've not yet triaged or decided on labels Dec 4, 2024
@snicoll snicoll added this to the 6.2.1 milestone Dec 5, 2024
@snicoll snicoll self-assigned this Dec 5, 2024
@snicoll snicoll changed the title NestedPlaceholderPart does not recursively resolve placeholders NestedPlaceholder are not recursively resolved if the fallback is a placeholder Dec 5, 2024
@snicoll snicoll closed this as completed in e618f92 Dec 5, 2024
@snicoll
Copy link
Member

snicoll commented Dec 5, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: core Issues in core modules (aop, beans, core, context, expression) type: regression A bug that is also a regression
Projects
None yet
Development

No branches or pull requests

3 participants