I’ve been trying to get wicket and guice working together, more specifically injecting a facade (or a controller, whatever) into the webpage, with guice. The problem seems to be that I cannot do any other injection than field injection, in the webpage. If I try to use setter injection, the setter just doesn’t get called. Constructor injection into the webpage doesn’t seem to be possible (or I didn’t find how).
So, I seem to be left with field injection as the only possibility when injecting in the webpage.
Can anybody, first of all, confirm that this is correct? I seem to have found on the site of apache that setter injection doesn’t work as of wicket 1.5 (I’m on 6 by the way) but haven’t found any more information about it.
Secondly, if, indeed, it’s only possible to do field injection in the webpage, how can I cleanly unit test field injection with guice? (I’m thinking about a mock test, all I need to know is that the facade in question is correctly called with the correct arguments after pressing a button, the facade itself can be tested in another unit test).
Didn’t supply any code, because the question seems to be rather basic. If needs be, I’ll put in some snippets
Kasper
I had been struggling with this too. The integration ended up really smooth:
http://software.danielwatrous.com/wicket-guice-including-unittests/
Following this method the injector is injected, which gives full flexibility.