MicroProfile defines several CDI interceptor bindings for use with Interceptors. E.g. @BulkHead:
https://microprofile.io/project/eclipse/microprofile-fault-tolerance/spec/src/main/asciidoc/bulkhead.asciidoc
At Payara we're implementing these now, but hit an implementation impediment where it's actually not really possible to obtain the interceptor binding annotations in such a way that it works for all cases.
The default way of getting the interceptor binding annotation from the target method fails when the annotation has been dynamically added via either a CDI extension or an interceptor factory.
E.g.
interceptionFactory
.configure()
.filterMethods(am -> am.getJavaMember().getName().equals("foo"))
.forEach(
amc -> amc.add(new BulkHeadLiteral(5)));
Unfortunately there's no standard way to get the interceptor binding annotation here from the interceptor, so no way to get the '5' that the interceptor needs to do its work.
A somewhat similar problem occurs when the annotation is part of a stereotype. In that case one needs to recurse into the stereotype in order to get to the actual interceptor binding annotation.
It's, more or less, implied that the interceptor should 'just work' in all cases, but I wonder how the other implementations approach this problem.
As many of us here are also involved with the CDI spec, maybe CDI-468 should be given somewhat more priority, so that it at least will be easier for newer versions?