[cdi-dev] Getting injection point from Bean#create
arjan.tijms at gmail.com
Thu Nov 20 17:22:49 EST 2014
On Thu, Nov 20, 2014 at 11:07 PM, Romain Manni-Bucau
<rmannibucau at gmail.com> wrote:
> Not sure what it means actually. InjectionPoint is highly contextual so
> having an exception (not a npe of course) would make sense to me.
> Bean#create is a "you know what you do" from my understanding since
> interceptors/decorators are not supported for instance so it shouldnt rely
> of things like that, no?
Sure, no interceptor/decorators, but the injection point -is- there of
course. I can see it being set in OWB as a special property on the
creational context if I walk down the stack trace in a debugger when
my Bean#create method is being called. An injection point is something
that implementations of Bean could always need, for instance to
retrieve the name of the field into which injection is taking place.
Of course, it being a "you know what you do", it's okay that it's not
as simple as having it injected into the Bean, and that some extra
code is needed to obtain it. As long as there is at least -a- way to
get hold of it.
The method I posted in the openings post does in fact work, but it
feels slightly hacky. If that's an acceptable way to get the injection
point, then so be it. But just wondering if it's not something that
works by chance and may break later.
More information about the cdi-dev