I have a Java EE Application in which I have an Interceptor class like this
@Interceptor
@Logged
public class LogInterceptor {
@AroundInvoke
public Object logMethod(InvocationContext context) throws Exception {
...
}
}
Now when I want it to work I annotate the target method with @Logged. Please correct me if my perception of this is wrong.
Now to the question.
Is it possible to pass/bind a variable (and when, how?) throught the annotation like so:
@Logged(ctx = methodContext)
public void someMethod(MethodContext methodContext) {
...
}
and then a use it in LogInterceptor.logMethod() ?
Or are there other options to accomplish this?