[cdi-dev] Extensions and spec-related observer method injection points question

Laird Nelson ljnelson at gmail.com
Fri Feb 17 11:47:44 EST 2017

On Fri, Feb 17, 2017 at 3:37 AM Antoine Sabot-Durand <
antoine at sabot-durand.net> wrote:

> After discussing and testing with Martin we discovered that having an
> Observer with a payload of type Object and an injected parameter that is
> not BeanManager is not supported.
> For instance:
> void MyObserver(@Observes Object payload, MyBean bean) { ... )
> Which makes sense since with observer resolution rules this observer will
> be invoked for all Lifecycle events.

Oh, that very specific aspect is an aspect I hadn't considered.  That makes

Your earlier point about how MyBean might not be resolved at invocation
time was one I didn't understand.  If I have:

void MyObserver(@Observes @Initialized(ApplicationScoped.class) Object
payload, MyBean bean) { ... }

...then surely MyBean would be resolved at this point, by definition?  (I
understand you're looking at this specific case, but even more generally
here: wouldn't MyBean be guaranteed to be resolved here?)

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/cdi-dev/attachments/20170217/fec3c5ed/attachment.html 

More information about the cdi-dev mailing list