I\'m trying to use something similar to org.springframework.cache.annotation.Cacheable
:
Custom annotation:
@Target(ElementType.METHOD)
I think you probably misunderstand what the framework is supposed to do for you vs. what you have to do.
SpEL support has no way to be triggered automagically so that you can access the actual (resolved) value instead of the expression itself. Why? Because there is a context and as a developer you have to provide this context.
The support in Intellij is the same thing. Currently Jetbrains devs track the places where SpEL is used and mark them for SpEL support. We don't have any way to conduct the fact that the value is an actual SpEL expression (this is a raw java.lang.String
on the annotation type after all).
As of 4.2, we have extracted some of the utilities that the cache abstraction uses internally. You may want to benefit from that stuff (typically CachedExpressionEvaluator
and MethodBasedEvaluationContext
).
The new @EventListener
is using that stuff so you have more code you can look at as examples for the thing you're trying to do: EventExpressionEvaluator
.
In summary, your custom interceptor needs to do something based on the #id
value. This code snippet is an example of such processing and it does not depend on the cache abstraction at all.