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.

> One more question though, In the example you're only using constructor
> injection. Any reason not to use field injection?

Actually, I use field injection most of the time, see above.

Best regards, --- Jan.



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

Reply via email to