[windup-dev] GraphContext in CDI?

Ondrej Zizka ozizka at redhat.com
Mon Feb 16 09:41:28 EST 2015


It would be useful in aligning the rules API - currently we have a mix 
of static classes, "event", and some CDI possibilities. So if I need to 
get something in a CDI-instantiated object, I have to either grab it 
from somewhere in a constructor, or use a setter in the place it is 
injected to. Which seems anti-standard, anti-pattern, anti-CDI and bad 
practice.
Not necessary though. (Necessary is a fuzzy, subjective and relative 
term anyway :)

Ondra


On 16.2.2015 04:28, Lincoln Baxter, III wrote:
> Yeah, this is not something that is currently supported. It *used* to 
> be injectable many months ago, but we removed that because there were 
> a number of bugs with the lazy initialization and I remember thinking 
> at the time that it were safer to remove and re-introduce later if 
> necessary/beneficial.
>
> Not sure we've really seen a need to inject it again yet at this point.
>
> On Sat, Feb 14, 2015 at 10:39 PM, Jess Sightler <jsightle at redhat.com 
> <mailto:jsightle at redhat.com>> wrote:
>
>     It is not currently possible to inject the current GraphContext.
>
>     On 02/13/2015 11:30 PM, Ondrej Zizka wrote:
>     > Hi,
>     >
>     > I was playing with CDI, trying to inject GraphContext into
>     > ArchiveIdentificationGraphChangedListener.
>     >
>     > The original way to get it there is through constructor param.
>     > So I changed is so it is passed by setter, for the purpose of this
>     > experiment.
>     >
>     > When I added @Inject GraphContext grCtx; it is injected something
>     > different than what the setter gets. I.e. different instances.
>     > So I conclude that this in GraphContextImpl
>     >
>     > @Produces
>     > @ApplicationScoped
>     > public GraphContext produceGraphContext()
>     >
>     > is not really giving something application scoped.
>     >
>     > Why?
>     > I know there's GraphContextFactory, but still - @Inject'ing
>     > GraphContext, in the current setup, should IMO return the same
>     > GraphContext - or not?
>     >
>     > Thanks,
>     > Ondra
>     >
>     > _______________________________________________
>     > windup-dev mailing list
>     > windup-dev at lists.jboss.org <mailto:windup-dev at lists.jboss.org>
>     > https://lists.jboss.org/mailman/listinfo/windup-dev
>
>     --
>     Calendar Free/Busy:
>     https://www.google.com/calendar/embed?src=jsightle%40redhat.com&ctz=America/New_York
>
>     _______________________________________________
>     windup-dev mailing list
>     windup-dev at lists.jboss.org <mailto:windup-dev at lists.jboss.org>
>     https://lists.jboss.org/mailman/listinfo/windup-dev
>
>
>
>
> -- 
> Lincoln Baxter, III
> http://ocpsoft.org
> "Simpler is better."
>
>
> _______________________________________________
> windup-dev mailing list
> windup-dev at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/windup-dev

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/windup-dev/attachments/20150216/12ee101b/attachment.html 


More information about the windup-dev mailing list