But I only need to keep a reference to a Guice injector in my WebApplication to use it across some methods in it, I don't need it inside my wicket components... I think the wicket-guice integration serves a different purpose, correct me if I'm wrong.

Edgar Merino


richardwilko escribió:
Have you looked at the wicket guice integration?  I think that does it
already.

Richard



Edgar Merino wrote:
Let me correct that last response: the problem is not solved yet. I thought it was but after redeploying my application again I got a serialization exception, why didn't the previously supplied "solution" didn't work? can anyone give me a hand on this? thanks in advance.

Edgar Merino




Edgar Merino escribió:
Ok I re-read the javadoc for the GuiceInjectorHolder and found out I had to use it as a MetaDataKey, so I did that in my application:

public void init() {
   //initialization code
   Injector injector = Guice.createInjector();
setMetaData(GuiceInjectorHolder.INJECTOR_KEY, new GuiceInjectorHolder(injector));
}

public void someMethod() {
Injector injector = ((GuiceInjectorHolder) getMetaData(GuiceInjectorHolder.INJECTOR_KEY)).getInjector();
   injector.getInstance(SomeClass.class);
}

I was thinking about adding a GuiceComponentInjector to my application, but I'm not using guice with wicket so I don't think I need that, any suggestion?

Edgar Merino



Edgar Merino escribió:
Hello,

I need to hold a reference to a Guice injector inside my WebApplication, however since the injector is not serializable I tried using a GuiceInjectorHolder and keeping a reference to it in my WebApplication, but I'm still getting serialization exceptions when redeploying my application. Why didn't it work? what should I do in this case to keep a reference to my Guice injector? Thanks in advance.

Edgar Merino

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





-----
http://www.richard-wilkinson.co.uk My blog:
http://www.richard-wilkinson.co.uk


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to