[ https://issues.apache.org/jira/browse/WICKET-613?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Igor Vaynberg resolved WICKET-613. ---------------------------------- Resolution: Fixed Fix Version/s: (was: 1.3.0-rc1) 1.3.0-beta2 removed failfast check as it caused an extra creation of a prototype bean instance upon injection > Prototype scoped Spring beans > ----------------------------- > > Key: WICKET-613 > URL: https://issues.apache.org/jira/browse/WICKET-613 > Project: Wicket > Issue Type: Bug > Components: wicket-spring > Affects Versions: 1.3.0-beta1 > Environment: JDK 6, Jetty > Reporter: RĂ¼diger Schulz > Assignee: Igor Vaynberg > Priority: Critical > Fix For: 1.3.0-beta2 > > > I copied the following text from my discussion on wicket-user, and was asked > to open an issue, so here it is: > http://www.nabble.com/Prototype-scoped-Spring-beans-tf3849285.html > For a more complex form I wanted to use a "stateful" Springbean, to which I > applied scope="prototype". The idea is to have one bean instance for every > Form instance. I would access the bean with PropertyModels and direct method > calls during construction (i.e. setting initial state from input parameters) > and during events, which would alter the state. I inject the bean into the > Form with @SpringBean annotation. > This works somehow, but sometimes, especially after using the backbutton, I > had the problem that the internal state was reset. So I analyzed the stack in > the constructor of the bean implementation, and found out that it was called > twice during construction of the Form. First, during the super() call, and > then again in the next line during a method call on that bean. I appended > both stacktraces below. The proxy itself does not change. > This happens again after going back and e.g. submitting again. This results > in a NPE, because the internal state is reset. > I understand from reading the mailing list that the Wicket-Proxy does nothing > but a lookup in the Application context, and does not know or care about > spring scope. > And here I'm a little stuck. I am already considering to put the state into > the Form, and make the Bean a singleton without any internal state. As that > would mean some heavy refactoring, I would prefer a way where the Spring > acces would work as I want. Or is this a wrong way altogether? -- This message is automatically generated by JIRA. - You can reply to this email to add a comment to the issue online.