On Mon, 3 Oct 2011 00:54:31 -0700 (PDT)
Zeldor <[email protected]> wrote:

> 2. How to fetch data from Guice in Session? I have a Repository<User>
> Inject, but when it is used in Session it throws nullpointer
> exception. Should I have it in session at all? I guess repopulating
> user data like that is not the best idea, I should probably just
> redirect him to login page again, if session somehow losses data.

Only components get automatic injection - to have the injection work in
session, put this in your Session constructor:

InjectorHolder.getInjector().inject(this);

Or for 1.5:

Injector.get().inject(this);

Carl-Eric
www.wicketbuch.de

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to