You can set whatever mocks you need in the webapplication class using the same setters that spring uses. Chances are you are going to need the webapplication instance present if you are testing wicket anyways as it is a very central object.
-Igor > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of > Joni Suominen > Sent: Thursday, October 27, 2005 2:01 AM > To: wicket-user@lists.sourceforge.net > Subject: RE: [Wicket-user] My take on Spring integration > > On Wed, 2005-10-26 at 10:59 -0700, Igor Vaynberg wrote: > > This is similar to how i do it. My application is a spring > bean that > > gets injected by spring on creation and is then used as a service > > locator. I am simply questioning the automatic injection > into pages, > > does it really make sense if it only takes you half way > there. If in > > my panel i need to do a ((MyPage)getPage()).getService() > then i might > > as well do ((MyApp)getApplication).getService(). > > I agree that it is very bad if Spring integration using IOC > can only be done as a half baked solution. However, I see > following problems when using Spring as a service locator. > > 1. Unit testing components > > It is not feasible to unit test wicket components wired with > full blown backend services. We often manually wire the > dependencies, which is very easy in IOC paradigm: > > public class MyTest extends TestCase { > public void setUp() { > MyComponent myComponent = new MyComponent(); > myComponent.setFinder(new MockFinder()); > } > } > > 2. How to abstract the service locator? > > Lets say I'm creating a reusable Dictionary component. I'd > like to abstract away the actual interface to dictionary > behind DictionaryLookupService. > > public class Dictionary extends Panel { > private transient DictionaryLookupService dictionaryLookupService; > > public void onClick() { > dictionaryLookupService.findWord(...); > ... > } > } > > This implementation, which expects the implementation of > DictionaryLookupService be injected, does not depend on any > particular page, wicket application or spring API. > > -- > Joni Suominen <[EMAIL PROTECTED]> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by the JBoss Inc. > Get Certified Today * Register for a JBoss Training Course > Free Certification Exam for All Training Attendees Through End of 2005 > Visit http://www.jboss.com/services/certification for more information > _______________________________________________ > Wicket-user mailing list > Wicket-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/wicket-user > > > ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today * Register for a JBoss Training Course Free Certification Exam for All Training Attendees Through End of 2005 Visit http://www.jboss.com/services/certification for more information _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user