On Tue, 2005-11-29 at 23:55 -0800, Igor Vaynberg wrote: > maybe a static factory method in the page is the cleanest solution. > > public class MyPage extends WebPage { > private MyPage(String param) { > .... > } > > public static MyPage(String param) { > return new MyPage(param); > } > > public static MyPageInjected(String param) { > MyPage p=new MyPage(param); SpringInjector.inject(p); return p; > } > } > > in conjunction with setters/getters this can be used cleanly in both > testcases and code. its a little more code, but it is very clean.
i'm not sure if this solves the issue Christian brought up. That is, a case where the injected dependency is needed in a constructor: public class MyPage extends WebPage { private MyPage(String param) { contactDao.findAll(); } // static factories .... } In spring this kind of situation is typically solved using either constructor injection or InitializingBean callback. But both ways are difficult to implement in wicket since they would make wicket one step closer to become a managed framework. Or did I misundersood something? -- Joni Suominen <[EMAIL PROTECTED]> ------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Do you grep through log files for problems? Stop! Download the new AJAX search engine that makes searching your log files as easy as surfing the web. DOWNLOAD SPLUNK! http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click _______________________________________________ Wicket-user mailing list Wicket-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/wicket-user