On 2010-10-07 04:51, Mauro Ciancio wrote:
Hello everyone,
   I'm using spring in one wicket project and I'm lost about how the
proxy stuff works. I've realized that the fields marked with
@springbean are injected when the component injection listener runs.

   Also, I've looked in AnnotProxyFieldValueFactory.class to find out
how the bean proxy is created and how it can be serialized.

   Now, this is my issue. The page is created by wicket, the injection
is done and I have the bean ready for use. If the page is serialized,
the bean will be reconstructed using the bean factory (through the
proxy). But, somehow when I click a non bookmarkable link in my page,
the bean is never reconstructed and I have the previous reference to
the bean (I mean, the same object).

   Is this the correct behavior? Shouldn't this bean be reconstructed
when another request arrives?

   BTW, I've defined all the beans with prototype scope, so it's not a
spring issue.

AFAIR the once the bean is looked up from spring it is being cached by AnnotProxyFieldValueFactory itself.

So using prototype scope will not work anyway: either way you always get a fresh bean (so you cannot keep state) or you will always get the same bean (even worse if the bean is stateful).

You probably should convert your code to using singleton beans and pass appropriate state from wicket component itself.

        lg

--
Leszek Gawron                              http://lgawron.blogspot.com

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org

Reply via email to