Guice && CDI (in particular AssistedInject)

464 views
Skip to first unread message

Andrew Hughes

unread,
Oct 4, 2011, 7:02:21 PM10/4/11
to google...@googlegroups.com
Hi All,

The CDI spec's been out for a while now and we have implementations Weld and WebBeans (coming soon). But I can't find a great deal of documentation/content that talks about the integration of Guice with CDI. Is this a good concept or flawed?

AssistedInject:
One feature I really like in Guice is AssistedInject (http://code.google.com/p/google-guice/wiki/AssistedInject). But I can't see how this could be done in CDI. Even if we dropped the generated factories through the use of annotations there is no way (AFAIK) to provide a blend of both injected and supplied arguments to a @Produces method.

Anyone got any thoughts and insight into this that they would care to share? 

--AH


Ales Justin

unread,
Oct 4, 2011, 8:16:50 PM10/4/11
to google...@googlegroups.com
You can use this:

Which will then help you implement a generic "factory" to handle assisted inject.

We're moving this (@SHT) feature into CDI 1.1.

HTH

-Ales

p.s.: please let me know if/when/where you implement assisted inject on top of CDI

--
You received this message because you are subscribed to the Google Groups "google-guice" group.
To post to this group, send email to google...@googlegroups.com.
To unsubscribe from this group, send email to google-guice...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/google-guice?hl=en.

Andrew Hughes

unread,
Oct 9, 2011, 7:29:09 PM10/9/11
to google...@googlegroups.com
Hi Ales,

Thank you for posting this. I can only find a few examples of this and it would appear useful, but I am not sure this achieves the same thing Guice's assisted injection.

The examples all appear to use a configuration argument supplied via a bespoke  annotation (which is exposed to the @AroundInnoke's InvocationContext argument). I can see how this can be used to automagically create impl's (thus there is a somewhat transparent factory in the background). But I don't see how this can satisfy what is IMHO the most worthwhile feature of Assisted Injection, blending a mixture of supplied and injected objects.

Perhaps I am missing something :) but this doesn't appear to be the same (I hope I am wrong).

CHEERS :)
--AH

Ales Justin

unread,
Oct 24, 2011, 7:12:37 AM10/24/11
to google...@googlegroups.com
The impl is gonna come in as part of Seam Solder module, track it here:

-Ales
Reply all
Reply to author
Forward
0 new messages