I missed the final keyword in the code. indeed removing it allows the
annotation to do its job.

Thanks for the information regarding constructor Vs, field injection. I am
very new to IoC and DI, so haven't yet come up with my own preference.

Many thanks to everyone.

Tim

On 9 November 2011 01:05, Steve Eynon <steve.ey...@alienfactory.co.uk>wrote:

> Hi,
>
> I've used T5-IoC outside of webapps many times...as Bob said, try it
> without the final (not that it would compile with...?) and ensure
> you're using the correct @Inject annotation:
>
> @org.apache.tapestry5.ioc.annotations.Inject
> public final Output o;
>
> public Hello() {
>    System.out.println(o);
> }
>
> I prefer the field injection over constructor injection myself - I
> find life too short to maintain the list of services in the
> constructor! And Mockito's @InjectMocks means I can still do all the
> unit testing I want!
>
> Steve.
>
> On 9 November 2011 07:43, Thiago H. de Paula Figueiredo
> <thiag...@gmail.com> wrote:
> > On Tue, 08 Nov 2011 20:04:31 -0200, Robert Zeigler
> > <robert.zeig...@roxanemy.com> wrote:
> >
> >> It's (mostly) a matter of personal preference. I personally also like
> >> Constructor Injection better because it clearly establishes the
> dependencies
> >> required for the class in a single location. Also, if you use
> constructor
> >> injection, you can declare your fields final, whereas you can't do that
> for
> >> the field injection.
> >
> > Agreed. And Tapestry-IoC's constructor injection can be done without
> > annotations, without any dependency on Tapestry-IoC. :)
> >
> > --
> > 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
> >
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org
> For additional commands, e-mail: users-h...@tapestry.apache.org
>
>

Reply via email to