Spring Expression Language in custom annotations.

Answered

Hello guys,

I wondering if there is a way to force IDEA to treat strings in custom annotations as SpEL expressions, like it does in @PreAuthorize#value field.

Thanks

3
5 comments
Avatar
Permanently deleted user

@Serge, is there a way to configure IDEA to always (in all projects) treat attributes of certain annotations as SpEL? For example out of the box, IDEA does not syntax highlight SpEL inside org.springframework.kafka.annotation.KafkaListener#topics.

0

Hi guys, by the way the only way it worked for me is alt+enter and inject SpEL into my IDEA, however I would like that any other developer from my team see that string as SpEL expression. 

The  comment above the Annotation method declaration, didn't work // language=Spring EL

1

Finally discovered the solution ("SpEL instead of Spring EL) after using IntelliSense to get suggestions for the Language annotation's String.

@KafkaListener(topics = /* language=SpEL */ "#{propertiesBean.getProperty()}")
0

Please sign in to leave a comment.