-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi jan,

On Oct 8, 2009, at 6:47 AM, Jan Kriesten wrote:


Hi Haim,

Yes, I remember seeing that. How would you add it to wicket? by adding ServiceInjector trait to the Application class or using the wicket- guice way (addComponentInstantiationListener(new GuiceComponentInjector(this));)?

the Injector is just a trait, so anywhere it's needed, I just add it to the corresponding class - whether it's a Wicket component or not doesn't matter. So
you have

class MyWebPage extends WebPage with Injector {
 @Inject val domainRepo: DomainRepo = domainRepo
}

class DomainRepo extends Repo with Injector {
 @Inject val customerRepo: CustomerRep = customerRepo
}

This is a general approach, so no need to add a intantiation listener.
I've started testing this approach and I'm a little stuck. I can easily inject objects like that for running the application, but how do I inject mock objects for testing? The module used by the injector (in the article's example) is hard-coded into the InjectorService object.

Thanks
- --
Haim
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Darwin)

iEYEARECAAYFAkrS4QwACgkQhwMtGgRKzT12UwCfRPCcLKumJDVT1PGHH7Q6JvvK
qmEAmwfI2P2rN1Z+UdzN001EtlW/6F88
=H3rt
-----END PGP SIGNATURE-----

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to