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

SPEL: no viable alternative at input '#{' [JAVA_SPEL_EXPRESSION_SYNTAX] #1353

Closed
syedyusufh opened this issue Sep 13, 2024 · 6 comments
Closed
Assignees
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: validation type: bug

Comments

@syedyusufh
Copy link

Started seeing the below error alert for the annotation mentioned since v4.24.0, application builds and works perfectly fine otherwise.

SPEL: no viable alternative at input '#{' [JAVA_SPEL_EXPRESSION_SYNTAX]

@ConditionalOnExpression("#{${some.property.delay-seconds:0} > 0}")

@BoykoAlex
Copy link
Contributor

You can disable SPEL validations via settings:
Screenshot 2024-09-13 at 00 04 11

You are seeing an error because we added syntax validation for SPEL expressions. This error doesn't affect the compilation so this error is just for information purposes. STS shows error because it expects the SPEL expression not to have #{ prefix and } suffix. It expects SPEL without prefix and suffix: @ConditionalOnExpression("${some.property.delay-seconds:0} > 0")

@martinlippert martinlippert added status: needs-discussion for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode and removed status: waiting-for-triage labels Sep 13, 2024
@martinlippert martinlippert added this to the 4.26.0.RELEASE milestone Sep 13, 2024
@martinlippert
Copy link
Member

Probably something we need to support as well for the validation

@BoykoAlex
Copy link
Contributor

The question is whether SPEL wrapped in #{} in @ConditionalOnExpression is a valid syntax. I'm not sure it is...

@syedyusufh
Copy link
Author

@BoykoAlex I can confirm it is a valid expression as application with the mentioned SPEL works dynamically as expected

@BoykoAlex
Copy link
Contributor

BoykoAlex commented Sep 13, 2024

I think the reason for this might be the ability to nest SPEL expressions inside SPEL expressions (to be verified)

@BoykoAlex
Copy link
Contributor

Looks like Spring allows it either wrapped in #{} or without and then it just automatically wraps it in #{} at runtime.

Fixed with 80de787

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
for: eclipse something that is specific for Eclipse for: vscode something that is specific for VSCode theme: validation type: bug
Projects
None yet
Development

No branches or pull requests

3 participants