More guice serialization problems

2008-10-16 Thread Edgar Merino

Hello once again,

   wicket-guice integration has been working good for me, but I needed 
to get some injected services in classes that were not Components, so I did:


Injector injector = ( (GuiceInjectorHolder) 
RequestCycle.get().getApplication().getMetaData(GuiceInjectorHolder.INJECTOR_KEY)).getInjector();

injector.injectMembers(this);

   This arises serialization problems with the Guice injector, although 
I'm not keeping a reference to the injector... this should be because 
the actual injected service is not handled by a wicket ioc proxy. Igor 
suggested salve, I've been doing some reading about it but haven't try 
it yet, but wouldn't it just throw the same exception when using salve 
since it's not a proxy either? or maybe this won't happen because salve 
would inject a local dependency (inside a method) when needed? can 
anyone clarify this for me (and maybe many others with the same doubt)?


Thanks again for the help,
Edgar Merino

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



Re: More guice serialization problems

2008-10-16 Thread Igor Vaynberg
salve removes fields and performs just in time lookup of the dependency. so
no serialization errors and your instances take up less ram.

as far as wicket's guice support goes you should really do this
InjectorHolder.getInjector().inject(this) - this will inject proxies instead
of actual dependencies.

-igor

On Thu, Oct 16, 2008 at 3:11 AM, Edgar Merino [EMAIL PROTECTED] wrote:

 Hello once again,

   wicket-guice integration has been working good for me, but I needed to
 get some injected services in classes that were not Components, so I did:

 Injector injector = ( (GuiceInjectorHolder)
 RequestCycle.get().getApplication().getMetaData(GuiceInjectorHolder.INJECTOR_KEY)).getInjector();
 injector.injectMembers(this);

   This arises serialization problems with the Guice injector, although I'm
 not keeping a reference to the injector... this should be because the actual
 injected service is not handled by a wicket ioc proxy. Igor suggested salve,
 I've been doing some reading about it but haven't try it yet, but wouldn't
 it just throw the same exception when using salve since it's not a proxy
 either? or maybe this won't happen because salve would inject a local
 dependency (inside a method) when needed? can anyone clarify this for me
 (and maybe many others with the same doubt)?

 Thanks again for the help,
 Edgar Merino

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