Hi As DocumentGenerator is a class you can use registry.autobuild to create an instance. This will inject the dependencies for you.
On Wed, Sep 21, 2011 at 5:34 PM, Martin Strand <[email protected]> wrote: > On Wed, 21 Sep 2011 13:19:51 +0200, nquirynen <[email protected]> > wrote: > >> if I do >> registry.getService(PolicyValueProviderSource.class) >> and pass this as a parameter to my DocumentGenerator's constructor it does >> work. >> Is this the way to go then? (my knowledge of Tapestry IoC is very small) > > > Yes, that is the correct way to retrieve a service. > You could also define a DocumentGenerator service in your AppModule, and use > "registry.getService(DocumentGenerator.class)" instead of "new > DocumentGenerator(...)" > Normally, you should not use "new" to instantiate a service; Tapestry should > instantiate it for you and automatically inject dependencies. > But in your case this should work just fine. > > Martin > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [email protected] > For additional commands, e-mail: [email protected] > > -- Regards Taha Hafeez Siddiqi (tawus) http://tawus.wordpress.com --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
