This is a big stumbling point in Tapestry that injection is different from components (including pages, mixins, and base component classes) and for services.
Injection for services is part of the Inversion of Control container, and its a bit less "magic". Tapestry takes it as far as providing the dependencies to your implementation class through the parameters of your classes' constructor. Actually putting those values into private final fields is your code's responsibility. Component injection is a bit more freewheeling, as Tapestry is actually rewriting your class on the fly and can do things like inject directly into fields (it actually creates a constructor and assigns the parameter to the field AND makes the field effectively read only). Allowing Tapestry to do that style of injection on services would be a tremendous technical challenge and would pose great problems with interoperability ... and nearly all the logic related to injection and class transformation is defined inside the container itself which would imply a two-level container and a bunch of other nastiness. The long and short of it is: services are (effectively) simple singletons with a easy and constant lifecycle and no mutable internal state. Pages and components are mired in the much more complex page lifecycle and the component hierarchy of the page and have considerable mutable internal state. On Fri, Feb 22, 2008 at 8:20 AM, Mahen Perera <[EMAIL PROTECTED]> wrote: > Hi all, > > > > A quick one, > > > > Can we inject services using @Inject in any class,, or is it restricted > to only Page classes. I mean classes which are in web.pages package. > > > > Thanks in advance for all replies. > > > > The information contained in this email is strictly confidential and for the > use of the addressee only, unless otherwise indicated. If you are not the > intended recipient, please do not read, copy, use or disclose to others this > message or any attachment. Please also notify the sender by replying to this > email or by telephone (+44 (0)20 7896 0011) and then delete the email and any > copies of it. Opinions, conclusions (etc.) that do not relate to the official > business of this company shall be understood as neither given nor endorsed by > it. IG Index plc is a company registered in England and Wales under number > 01190902. VAT registration number 761 2978 07. Registered Office: Friars > House, 157-168 Blackfriars Road, London SE1 8EZ. Authorised and regulated by > the Financial Services Authority. FSA Register number 114059. > -- Howard M. Lewis Ship Creator Apache Tapestry and Apache HiveMind --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]