I am relatively new to tapestry so this was a huge help not only running a service on startup, but learning more about the Ioc container overall.
Thanks, Zack Lubor Gajda wrote: > > Hi, > > Just inject your service to the 'contributeRegistryStartup' method as > final > parameter and directly use in Runnable inner class. For instance: > > public static void > contributeRegistryStartup(OrderedConfiguration<Runnable> > configuration, final Scheduler scheduler) { > configuration.add("SchedulerStartup", new Runnable() { > public void run() { > scheduler.start() > } > }); > } > > Regards, > Lubor > > > On Fri, May 30, 2008 at 2:11 PM, 9902468 <[EMAIL PROTECTED]> wrote: > >> >> Hi! >> >> My parameter service needs to connect to database, inspect that all >> parameters are inplace, and if there are missing (new) parameters I have >> to >> create them and assign default values. This should occur every time that >> the >> application is started. >> >> How do I do it? I read the IoC Registry startup, but I don't know how to >> inject services to the Runnable. I have following code that is working in >> my >> Tapestry Module: >> >> static Log log = LogFactory.getLog(EblanketterModule.class); >> >> public static void >> contributeRegistryStartup(OrderedConfiguration<Runnable> configuration) { >> configuration.add("InitializeDatabaseParams", new Runnable() { >> >> public void run(){ >> >> >> >> log.info("At startup"); >> } >> >> }); >> } >> -- >> View this message in context: >> http://www.nabble.com/How-to-call-service-during-startup--tp17558546p17558546.html >> Sent from the Tapestry - User mailing list archive at Nabble.com. >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > > -- View this message in context: http://www.nabble.com/How-to-call-service-during-startup--tp17558546p17579555.html Sent from the Tapestry - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]