question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Syntax check for Annotations with Spring Expression Language

See original GitHub issue

Annotations like e.g. @Cacheable, @EventListener or @PreAuthorize take a String literal containing logic in form of SpEL. In general this is error prone since there is no compile-time check.

It would be nice to be warned earlier that the expression is erroneous. It seems this is a feature of IntelliJ: grafik

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
martinlippertcommented, Jul 27, 2020

As mentioned, there is a basic check for the syntax of the SpEL expression in place now. It works across Java annotations as well as Spring XML config files. It does not yet take the @AliasFor information into account, that is something for future work in this area.

Nevertheless, I mark this issue as resolved and will deliver this as part of the upcoming Spring Tools 4.7.1 update.

2reactions
martinlippertcommented, Jun 9, 2020

This would indeed be a super awesome enhancement for the Spring Tools 4. I will definitely put this on the list of things we should take a look at for future releases.

Read more comments on GitHub >

github_iconTop Results From Across the Web

8. Spring Expression Language (SpEL)
The Spring Expression Language (SpEL for short) is a powerful expression language that supports querying and manipulating an object graph at runtime.
Read more >
Spring Expression Language Guide - Baeldung
The Spring Expression Language (SpEL) is a powerful expression language that supports querying and manipulating an object graph at runtime.
Read more >
Spring SpEL - Quick Guide - Tutorialspoint
The Spring Expression Language, SpEL is a very powerful expression language and it supports querying and manipulating an object graph at runtime. It...
Read more >
Spring Expression Language - a Spring 3 Feature You May ...
The Syntax. First off, SpEL can be used in both XML and annotation metadata (also known as Spring configuration or wiring). In either...
Read more >
Spring Expression Language (SpEL) Example
Spring Expression Language is passed in #{ <expression string> } format in both cases, annotation configuration as well as XML configuration. In ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found