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]