Re: Symbol field injection doesn't work when the symbol is used in the service class constructor
On Wed, 14 Nov 2012 16:48:18 -0200, Dragan Sahpaski wrote: Yes off course. I realized that short after clicking the send button. I guess sending an email to few thousand people did it. :) That should have the same reason sometimes you have a question, and then, while you're asking it to someone else near you, the answer appears in your mind. :P -- Thiago H. de Paula Figueiredo - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org
Re: Symbol field injection doesn't work when the symbol is used in the service class constructor
On Wed, Nov 14, 2012 at 9:14 AM, Dragan Sahpaski wrote: > Hi, > This currently doesn't work and I can't find it documented anywhere. It > doesn't fail or anything it's just that the value isn't set yet in the > constructor. > Constructor injection for the symbol on the other hand works as expected. > Is this expected behavior and if yes should it be changed? > It's the expected behavior. The object has to be created before you can inject to it. I'd always favor constructor injection, it's thread safe and you declare the attributes final. Kalle
Re: Symbol field injection doesn't work when the symbol is used in the service class constructor
Yes sure, Thanks Cheers, Dragan Sahpaski On Wed, Nov 14, 2012 at 6:19 PM, Tony Nelson wrote: > I think you need to use constructor injection for that.. > > http://tapestry.apache.org/symbols.html > > public MySeviceImpl(@Value("mySymbol") boolean mySymbolValue) { > ... > } > > I don't believe it's possible to set a property on an object before the > constructor is called. > > Tony > > -Original Message- > From: dragan.sahpas...@gmail.com [mailto:dragan.sahpas...@gmail.com] On > Behalf Of Dragan Sahpaski > Sent: Wednesday, November 14, 2012 12:14 PM > To: Tapestry users > Subject: Symbol field injection doesn't work when the symbol is used in > the service class constructor > > Hi, > This currently doesn't work and I can't find it documented anywhere. It > doesn't fail or anything it's just that the value isn't set yet in the > constructor. > > @Inject > @Symbol("mySymbol"); > private boolean mySymboValue; > > public MyServiceImpl(){ > System.out.println(mySymbolValue); // prints false } > > public void someMethod(){ > System.out.println(mySymbolValue); // prints true } > > Constructor injection for the symbol on the other hand works as expected. > > Is this expected behavior and if yes should it be changed? > > Thanks > > Since 1982, Starpoint Solutions has been a trusted source of human capital > and solutions. We are committed to our clients, employees, environment, > community and social concerns. We foster an inclusive culture based on > trust, respect, honesty and solid performance. Learn more about Starpoint > and our social responsibility at > http://www.starpoint.com/social_responsibility > > This email message from Starpoint Solutions LLC is for the sole use of > the intended recipient(s) and may contain confidential and privileged > information. Any unauthorized review, use, disclosure or distribution is > prohibited. If you are not the intended recipient, please contact the > sender by reply email and destroy all copies of the original message. > Opinions, conclusions and other information in this message that do not > relate to the official business of Starpoint Solutions shall be understood > as neither given nor endorsed by it. > > - > To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org > For additional commands, e-mail: users-h...@tapestry.apache.org >
RE: Symbol field injection doesn't work when the symbol is used in the service class constructor
I think you need to use constructor injection for that.. http://tapestry.apache.org/symbols.html public MySeviceImpl(@Value("mySymbol") boolean mySymbolValue) { ... } I don't believe it's possible to set a property on an object before the constructor is called. Tony -Original Message- From: dragan.sahpas...@gmail.com [mailto:dragan.sahpas...@gmail.com] On Behalf Of Dragan Sahpaski Sent: Wednesday, November 14, 2012 12:14 PM To: Tapestry users Subject: Symbol field injection doesn't work when the symbol is used in the service class constructor Hi, This currently doesn't work and I can't find it documented anywhere. It doesn't fail or anything it's just that the value isn't set yet in the constructor. @Inject @Symbol("mySymbol"); private boolean mySymboValue; public MyServiceImpl(){ System.out.println(mySymbolValue); // prints false } public void someMethod(){ System.out.println(mySymbolValue); // prints true } Constructor injection for the symbol on the other hand works as expected. Is this expected behavior and if yes should it be changed? Thanks Since 1982, Starpoint Solutions has been a trusted source of human capital and solutions. We are committed to our clients, employees, environment, community and social concerns. We foster an inclusive culture based on trust, respect, honesty and solid performance. Learn more about Starpoint and our social responsibility at http://www.starpoint.com/social_responsibility This email message from Starpoint Solutions LLC is for the sole use of the intended recipient(s) and may contain confidential and privileged information. Any unauthorized review, use, disclosure or distribution is prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. Opinions, conclusions and other information in this message that do not relate to the official business of Starpoint Solutions shall be understood as neither given nor endorsed by it. - To unsubscribe, e-mail: users-unsubscr...@tapestry.apache.org For additional commands, e-mail: users-h...@tapestry.apache.org