Timo Rantalaiho schrieb:
On Fri, 06 Feb 2009, Andreas Petersson wrote:
i wonder: myDao is most likely not serializable.
WebPage is. WebPage should get serialized. so why the heck does this not throw an error? what kind of magic is going on here?

Look at what GuiceComponentInjector does (or something it calls).

The access to the dao is proxied by a serialisable proxy.
The proxy can be serialised and deserialised without problems, and it will access the real dao.

Best wishes,
Timo

ok, now the puzzle pieces come together. as described at http://cwiki.apache.org/WICKET/guice-integration-pitfall.html there are proxies/CGlib subclasses created. - now i understand why these are necessary, and why it does not matter that they are not serializable.
it all makes sense now :) thanks a lot.


tough a comment by Igor Vaynberg <https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ivaynberg> at https://issues.apache.org/jira/browse/WICKET-1130 made me wonder: guice already uses annotations, so - at least for it - it would be possible to skip the proxying part.

otoh, EasyMock Class Extension also creates instances of classes, even without protected no-args constructor, so i guess there must be a way to do it.
-------
/Igor Vaynberg <https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ivaynberg> - 24/Mar/08 04:56 PM/
/moving this to 1.5.

basically when injecting instances of concrete classes we are limited by cglib which requires a default visible constructor and no final methods so that it can create a subclass for our proxy.

once we switch to jdk5 we can require usage of annotations for injection and then we can remove the proxies and use hooks in page serialization to inject objects and hooks in deserialzation to make sure injected fields are skipped. /
[ Show ยป <https://issues.apache.org/jira/browse/WICKET-1130> ]
Igor Vaynberg <https://issues.apache.org/jira/secure/ViewProfile.jspa?name=ivaynberg> - 24/Mar/08 04:56 PM moving this to 1.5. basically when injecting instances of concrete classes we are limited by cglib which requires a default visible constructor and no final methods so that it can create a subclass for our proxy. once we switch to jdk5 we can require usage of annotations for injection and then we can remove the proxies and use hooks in page serialization to inject objects and hooks in deserialzation to make sure injected fields are skipped.
/---------
/

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

Reply via email to