[
https://issues.apache.org/jira/browse/OWB-593?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13067593#comment-13067593
]
Arne Limburg commented on OWB-593:
----------------------------------
I guess this is related to OWB-569
The problem is, that OWB uses to much reflection API, where it should use
AnnotatedType. CDI 1.1 will clarify this.
> Interceptor binding added on an interceptor class at ProcessAnnotatedType
> phase is not considered
> -------------------------------------------------------------------------------------------------
>
> Key: OWB-593
> URL: https://issues.apache.org/jira/browse/OWB-593
> Project: OpenWebBeans
> Issue Type: Bug
> Components: Interceptor and Decorators
> Affects Versions: 1.0.0
> Reporter: Kevin Pollet
> Assignee: Gurkan Erdogdu
>
> I have an annotation only allowed on methods (not annotated with
> @InterceptorBinding). I want to add this annotation as an interceptor binding
> and register the corresponding interceptor programmatically (the interceptor
> class cannot be annotated with the "new" interceptor binding annotation). For
> that I've created the following extension and interceptor:
> public class FooExtension implements Extension {
> void registerInterceptorBinding(@Observes BeforeBeanDiscovery event) {
> event.addInterceptorBinding(Foo.class);
> }
> void processFooInterceptorAnnotatedType(@Observes
> ProcessAnnotatedType<FooInterceptor> event) {
> AnnotatedType<FooInterceptor> annotatedType = new
> AnnotatedTypeBuilder<FooInterceptor>()
> .readFromType(event.getAnnotatedType())
> .addToClass(new AnnotationLiteral<Foo>() {})
> .create();
> event.setAnnotatedType(annotatedType);
> }
> }
> @Interceptor
> public class FooInterceptor {
> @AroundInvoke
> public Object intercept(InvocationContext context) throws Exception {
> return "Foo interceptor called";
> }
> }
> With the code above I have the following exception at startup:
> org.apache.webbeans.exception.WebBeansConfigurationException: WebBeans XML
> configuration defined in /beans.xml is failed. Reason is : Interceptor class
> : com.github.kevinpollet.sample.cdi.interceptor.FooInterceptor must have at
> least one @InterceptorBindingType
> If I use AfterBeanDiscovery#addBean() all works fine but it's not as neat as
> the previous approach and I've seen nothing in the spec that disallows it.
> FYI, this approach works fine with Weld.
--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira