that's a nice and clean approach for simple services, less code... but builder methods should have access to auto-wiring also, ...
Davor Hrg On 4/13/07, Howard Lewis Ship <[EMAIL PROTECTED]> wrote:
Yep, I'm in the middle of changes where you'll be able to specify a class as a service and T5 IoC will perform injections o n the class' constructor. It's inspired by Guice. So for a simple service, it will look like: public class MyModule { public void bind(ServiceBinder binder) { binder.bind(MyService.class, MyServiceImpl.class); } Your example, though, is one that will continue to operate the traditional way (when there's more involved than dependency injection via constructor). On 4/12/07, Davor Hrg <[EMAIL PROTECTED]> wrote: > I started converting a small project from hivemind to tapestry-ioc, > > this was just to compare experiences... > > most of it went fine, but when it came to auto-wiring, it got > overcomplicated. > > auto-wiring works for parameters in module's build-methods, > but this still means that I have to manually construct the service > and set the dependencies provided in build method parameters. > > for example: > public ICronService buildCron( > RegistryShutdownHub hub, > UserService userService, > Log log, > ){ > CronService cron = new CronService(hub, userService, log); > cron.start(); > return cron; > } > > this could be shorter (provided that container creates instance nad > autowires properties) > > public ICronService buildCron(CronService cron){ > cron.start(); > return cron; > } > > > the problem here is not in ammout of writing > (the latter code is little confusing also) > the problem lies in the fact that if I add another dependancy: > - create field > - create setter > this was enough in hivemind, but in tapestry-ioc > I have to change the build method: > - add an extra parameter > - call the setter > > any thoughts on this ? > any plans ? > > Davor Hrg > -- Howard M. Lewis Ship TWD Consulting, Inc. Independent J2EE / Open-Source Java Consultant Creator and PMC Chair, Apache Tapestry Creator, Apache HiveMind Professional Tapestry training, mentoring, support and project work. http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]