-
1. Re: MDB not intercepted when annotation is put dynamically
tremes Oct 16, 2015 5:00 AM (in response to matthieu.brouillard)Hi Matthieu,
Which WidlFly version do you use? And which weld version do you use? Reproducer looks good on the first glance. I'll try and will let you know.
-
2. Re: MDB not intercepted when annotation is put dynamically
matthieu.brouillard Oct 16, 2015 5:29 AM (in response to tremes)Hi Tomas,
the Wildfly version is 8.2.1.Final with Weld 2.2.6.Final.
Also something I have noticed is that the MDB class is not listed when Observing CDI ProcessBean events:
<T> void processBean(@Observes ProcessBean<T> bean) {
LOGGER.error("CDI process bean: {}", bean.getAnnotated().getBaseType().toString());
}
Adding that to the Extension does not show the MDB class that should be intercepted but shows for example the stateless class.
-
3. Re: MDB not intercepted when annotation is put dynamically
tremes Oct 16, 2015 8:21 AM (in response to matthieu.brouillard)Yes ProcessBean event is not observed, because MDB is not CDI managed bean and that's likely also the reason why your dynamically added interceptor doesn't work. If you read Java EE 7 spec (JSR-000342 Java EE 7 Final Release for Evaluation) chapter "EE.5.24 Support for Dependency Injection" there is following:
.......
Note that using these steps causes the container to create a non-contextual
instance, which is not managed by CDI but rather by the Java EE container.
1. Obtain a BeanManager instance.
2. Create an AnnotatedType instance for the component into which injection is to
occur.
........
So your MDB is likely not contextual instance in this case and there is likely no way how the given AnnotatedType could change.
-
4. Re: MDB not intercepted when annotation is put dynamically
matthieu.brouillard Oct 16, 2015 5:58 PM (in response to tremes)Thank you Tomas, I'll have a deeper into the spec to understand why such a difference between MDBs and SLSB.
I someone knows a way to do what I want event if I need to hook into Wildfly internals/modules instead of CDI I would also be glad to hear a voice there.
Thanks for your help and hints.