Re: IoC alone and annotations

2011-11-08 Thread Tim Fletcher
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

Re: IoC alone and annotations

2011-11-08 Thread Steve Eynon
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);

Re: IoC alone and annotations

2011-11-08 Thread Robert Zeigler
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

Re: IoC alone and annotations

2011-11-08 Thread Tim Fletcher
Thanks for your response Thiago! Again following the instructions at http://wiki.apache.org/tapestry/Tapestry5HowToIocOnly public class Hello { public final Output o; public Hello(Output o) { this.o = o; System.out.println(o); } } I would like to be able to replace it with public class Hello

Re: IoC alone and annotations

2011-11-08 Thread Thiago H. de Paula Figueiredo
On Tue, 08 Nov 2011 18:20:40 -0200, Tim Fletcher wrote: Hi All, Hi! I have followed the instructions at [wiki Tapestry5HowToIocOnly] and got that working. However, is it possible to use annotations instead of passing the instance in

IoC alone and annotations

2011-11-08 Thread Tim Fletcher
Hi All, I have followed the instructions at [wiki Tapestry5HowToIocOnly] and got that working. However, is it possible to use annotations instead of passing the instance in the constructor? Thanks in advance, Tim