There's more than one way to do these things. A service builder method (see the docs) is fully responsible for instantiating a service. Tapestry treats this method as a black box. Inside the method, your code can instantiate a class, provided dependencies, and do other initializations, such as registering the new instance as a listener.
However, most people don't want to have to write a main class and a builder method; that's why you can bind the service, and let Tapestry instantiate it, set dependencies, and invoke @PostInjection methods to do secondary initializations, such as this listener business. Don't like the annotations? Don't use them ... but you'll write more code, since you've deprived Tapestry IoC of the hints it need to instantiate your service for you. On Wed, Oct 5, 2011 at 2:47 PM, Thiago H. de Paula Figueiredo <thiag...@gmail.com> wrote: > On Wed, 05 Oct 2011 17:23:44 -0300, Muhammad Gelbana <m.gelb...@gmail.com> > wrote: > >> I've done everything as directed in the page but the annotation >> *@PostInjection *didn't work so I had to invoke the method "public void >> startupService(RegistryShutdownHub shutdownHub)" manually at a static >> method annotated with @Startup in my "AppModule" class. > > You mixed two things that are different. You need this method to your > AppModule to contribute something to be run at startup: > > public static void contributeRegistryStartup(OrderedConfiguration<Runnable>) > { > ... > } > > Please read the Tapestry-IoC documentation to understand what this method > does. > > For shutdown, inject RegistryShutdownHub and add RegistryShutdownLister to > it. > > -- > Thiago H. de Paula Figueiredo > Independent Java, Apache Tapestry 5 and Hibernate consultant, developer, and > instructor > Owner, Ars Machina Tecnologia da Informação Ltda. > http://www.arsmachina.com.br > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org > > -- Howard M. Lewis Ship Creator of Apache Tapestry The source for Tapestry training, mentoring and support. Contact me to learn how I can get you up and productive in Tapestry fast! (971) 678-5210 http://howardlewisship.com --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org