-
Notifications
You must be signed in to change notification settings - Fork 38.4k
SpEL ternary expression is missing fallback part during parsing. #34117
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
Comments
The If you intend for that be evaluated as a SpEL expression, you need to use the Does switching to the If not, what is it you are trying to achieve? |
Unfortunately, We are using SpEL expression to parse the expression and replace placeholders with property values.
|
Does the following work for you?
|
If I wrap up with And I am constructing the property placeholder helper via |
Please provide a minimal sample application that demonstrates what you are trying to achieve, one that we can download and run ourselves, such as a public Git repository or a ZIP file. Without that, I'm afraid we cannot determine if what you are trying to accomplish is supported. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue. |
Having a Spring ternary expression
"Did he win the race? ${['win'] ? 'Yes.' : "No.'}"
, PlaceholderParser will break it into two parts.{ text : "Did he win the race?" }
{ key : "['win'] ? 'Yes.'", fallback : "'No.'", text : "['win'] ? "'Yes.' : 'No.'" }
But while resolving the SimplePlaceholderPart context, it returns the
key
value of it which misses thefallback
part (PlaceholderParser.class : L376
).Now, if try
SpelExpression.doParseExpression("['win'] ? 'Yes.'")
,this.eatToken(TokenKind.COLON);(InternalSpelExpressionParser.class : L155)
will throw the exception.The text was updated successfully, but these errors were encountered: