Dne 21.8.2017 v 13:45 arjan tijms napsal(a):
Normally a workaround to get the interceptor bindings from within an
Interceptor is to inspect the target and/or the injected intercepted bean.
However, when adding an interceptor via the new CDI 2.0 interception
factory, things become a bit more muddy.
Weld has the following method to get the bindings from the
Set<Annotation> bindings = (Set<Annotation>)
In fact, a more safe way is to use the Weld API, cast the invocation
context to org.jboss.weld.interceptor.WeldInvocationContext and use the
But this is obviously non-standard.
Yes. There is already a spec issue:
but this would require a change
in interceptors spec.
Is there a standard way to get the bindings? Perhaps getting hold of the
Bean<T> that represents the current Interceptor?
You can inject a bean with scope @Dependent, qualifier @Default and type
Interceptor into any interceptor instance. However, this will not help
for @Nonbinding value members of an interceptor binding.
cdi-dev mailing list
Note that for all code provided on this list, the provider licenses the code under the
Apache License, Version 2 (http://www.apache.org/licenses/LICENSE-2.0.html
). For all other
ideas provided on this list, the provider waives all patent and other intellectual
property rights inherent in such information.
Senior Software Engineer
Red Hat, Czech Republic