Skip to content

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

Closed

Description

@syedyusufh

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}")

Activity

  1. BoykoAlex commented on Sep 13, 2024

    @BoykoAlex
    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")

  2. added
    for: eclipse
    for: vscode
    and removed on Sep 13, 2024
  3. added this to the 4.26.0.RELEASE milestone on Sep 13, 2024
  4. martinlippert commented on Sep 13, 2024

    @martinlippert
    Member

    Probably something we need to support as well for the validation

  5. BoykoAlex commented on Sep 13, 2024

    @BoykoAlex
    Contributor

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

  6. syedyusufh commented on Sep 13, 2024

    @syedyusufh
    Author

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

  7. BoykoAlex commented on Sep 13, 2024

    @BoykoAlex
    Contributor

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

  8. BoykoAlex commented on Sep 15, 2024

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

Metadata

Metadata

Assignees

Labels

for: eclipsefor: vscodetheme: validationtype: bug

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions