I can life without the return value as well. +1 on this specific change on ApplicationSettings
Juergen On 10/4/05, Sven Meier <[EMAIL PROTECTED]> wrote: > Hello Martin, > > I have added a JavaBean-compliant setPageFactory() to my settings > subclass (because of the return type of setDefaultPageFactory()) so my > Spring configuration is correct. > > Thanks for the tipp with MethodInvokingFactoryBean, but IMHO this is way > too much wordy. > > So quoting Eelco: > > >I think we can get rid of the chaining setters in classes like > >ApplicationSettings. > > +1 > > I don't think Sun will 'enhance' the bean spec, so I'd really like Wicket to > adhere to (some) common standards. > > Thanks > > Sven > > Martin Fey wrote: > > >Hi Sven, > > > >the property name of the ApplicationSettings-object is misnamed, it should > >be: > > <bean id="settings" class="test.MySettings"> > > <constructor-arg ref="application"/> > > <property name="defaultPageFactory" ref="pageFactory"/> > > </bean> > > > >In general, Spring beans have to be bean-conform. So there is a workaround > >for using such setters that doesn't return the trivial void (have a look at > >TheServerSide.com: > >http://www.theserverside.com/articles/article.tss?l=SpringLoadedObserverPattern). > > > >Try something like this (keep in mind that Spring beans are singletons by > >default): > > > ><beans> > > <bean id="application" class="test.MyApplication"> > > <property name="settings" ref="settings"/> > > <property name="sessionFactory" ref="sessionFactory"/> > > </bean> > > > > <bean id="settings" class="test.MySettings"> > > <constructor-arg ref="application"/> > > <property name="pageFactory" ref="pageFactory"/> > > </bean> > > > > <bean id="pageFactory" class="test.MyPageFactory"/> > > > ><bean id="registerPageFactory" > >class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"> > > <property name="targetObject"><ref local="settings"/></property> > > <property > > name="targetMethod"><value>setDefaultPageFactory</value></property> > > <property name="arguments"><ref bean="pageFactory"/></property> > ></bean> > > > > <bean id="sessionFactory" class="test.MySessionFactory"> > > <constructor-arg ref="application"/> > > </bean> > ></beans> > > > > > > > > > >Regards > > Martin > > > > > > > > > > > > > >>>>[EMAIL PROTECTED] 04.10.05 10:57 >>> > >>>> > >>>> > >Hello, > > > >I'm using a custom IWebApplicationFactory to create a wicket application > >inside its own Spring application context: > > > ><beans> > > <bean id="application" class="test.MyApplication"> > > <property name="settings" ref="settings"/> > > <property name="sessionFactory" ref="sessionFactory"/> > > </bean> > > > > <bean id="settings" class="test.MySettings"> > > <constructor-arg ref="application"/> > > <property name="pageFactory" ref="pageFactory"/> > > </bean> > > > > <bean id="pageFactory" class="test.MyPageFactory"/> > > > > <bean id="sessionFactory" class="test.MySessionFactory"> > > <constructor-arg ref="application"/> > > </bean> > ></beans> > > > >I've added setSettings() to my application, so that MySettings could be > >injected into the application. > > > >Now to my problem: > >It seems that Spring does not like Wicket's 'chainable' setters because of > >their return type, e.g. > > > > public ApplicationSettings setDefaultPageFactory(IPageFactory > > defaultPageFactory) > > > >A NotWritablePropertyException will be thrown because of the non-void return > >type. > > > >After adding setPageFactory() I realized that I have to add a Java-Beans > >compliant setter for each property of ApplicationSettings, e.g. > > > > <property name="stripWicketTags" value="true"/> > > > >I'm not sure who is to blame for this, Spring because it's so picky or > >Wicket with its baroque setter idiom (or perhaps me ;). > > > >Does anybody have a nice solution to this? > > > >Sven > > > > > >------------------------------------------------------- > >This SF.Net email is sponsored by: > >Power Architecture Resource Center: Free content, downloads, discussions, > >and more. http://solutions.newsforge.com/ibmarch.tmpl > >_______________________________________________ > >Wicket-user mailing list > >[email protected] > >https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > >------------------------------------------------------- > >This SF.Net email is sponsored by: > >Power Architecture Resource Center: Free content, downloads, discussions, > >and more. http://solutions.newsforge.com/ibmarch.tmpl > >_______________________________________________ > >Wicket-user mailing list > >[email protected] > >https://lists.sourceforge.net/lists/listinfo/wicket-user > > > > > > > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by: > Power Architecture Resource Center: Free content, downloads, discussions, > and more. http://solutions.newsforge.com/ibmarch.tmpl > _______________________________________________ > Wicket-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/wicket-user > ------------------------------------------------------- This SF.Net email is sponsored by: Power Architecture Resource Center: Free content, downloads, discussions, and more. http://solutions.newsforge.com/ibmarch.tmpl _______________________________________________ Wicket-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/wicket-user
