users@glassfish.java.net

Re: CDI and JSF2 PhaseListeners

From: <glassfish_at_javadesktop.org>
Date: Thu, 25 Feb 2010 09:05:15 PST

Hi Wolfgang,

The integration is clean, provided that you use CDI from beans that CDI itself created. However, I want to make CDI do what [i]I[/i] want in beans that [i]I[/i] (or somebody else like JSF) created. I want full control. There's too much magic in CDI at the moment. Or so it seems to me now. (I hope things will clear up for me in the future but I don't know for sure.) Joel Spolsky's Law of Leaky Abstractions comes to mind. Some day something even more strange will happen, I will be facing some very strange problem, and I will need to [b]know[/b] what CDI is doing behind the scene, so that I can find a workaround (or a solution) to the problem at hand. :)

I wish to ask you a question: how do you deal with CDI in ZK? For example, if you have an object that has [i]not[/i] been created by CDI (like JSF's PhaseListeners) and you need CDI to give you some existing bean that you can use in that object, how do [i]you[/i] ask CDI to give it to you? Or, alternatively, have you found a programmatic way to ask CDI to [i]create[/i] a bean for you (and perform the necessary injections into it)? Something like Guice's injector.getInstance(...). This is a simple API that I feel comfortable with. I'd like to have something like that in CDI.

I don't know what you are forced to do in ZK, but your comment implied that things there are not very easy. But have you been able to do some of the things above? If yes, then how?
[Message sent by forum member 'vesuvius' (vesuvius_prime_at_hotmail.com)]

http://forums.java.net/jive/thread.jspa?messageID=388733