You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@wicket.apache.org by "Igor Vaynberg (JIRA)" <ji...@apache.org> on 2010/11/28 19:25:37 UTC

[jira] Resolved: (WICKET-3204) Singleton bean is reinstantiated by wicket

     [ https://issues.apache.org/jira/browse/WICKET-3204?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Igor Vaynberg resolved WICKET-3204.
-----------------------------------

    Resolution: Invalid
      Assignee: Igor Vaynberg

the second instance is created because wicket asks cglib to create a proxy for the bean. cglib generates a subclass for the bean, but this subclass is bound by the same rules as any java class and calls the default constructor - which increments the count. the count will be incremented any time a cglib proxy is generated for the bean, whether it is done by wicket, spring, or anything else.

this is the expected behavior and method calls on the proxy will always go back to the correct singleton's instance. constructor invocations are not a good place to measure instance counts when using proxies.

> Singleton bean is reinstantiated by wicket
> ------------------------------------------
>
>                 Key: WICKET-3204
>                 URL: https://issues.apache.org/jira/browse/WICKET-3204
>             Project: Wicket
>          Issue Type: Bug
>          Components: wicket-spring
>    Affects Versions: 1.4.13
>            Reporter: Zeti
>            Assignee: Igor Vaynberg
>         Attachments: wicket3204.zip
>
>
> My bean declared as @Scope(value = "singleton") is reinstantiated before injection. This includes the symptom, that its session factory was null.
> After a two hour debugging session with pertl (Thanks!) we found the following workaround:
> Use
> new SpringComponentInjector(this, WebApplicationContextUtils.getRequiredWebApplicationContext(this.getServletContext()), false)
> instead of
> new SpringComponentInjector(this)
> as recommended in the Wiki: https://cwiki.apache.org/WICKET/spring.html

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.