This week's book giveaway is in the OCPJP forum.
We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line!
See this thread for details.
The moose likes Spring and the fly likes @Value annotation Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "@Value annotation" Watch "@Value annotation" New topic
Author

@Value annotation

pramod talekar
Ranch Hand

Joined: Apr 26, 2010
Posts: 323

Hi,

Could you please tell why Q and 2 and not P & 1 are getting printed in the below code :



Thanks.


Thanks,
Pramod
Kathleen Angeles
Ranch Hand

Joined: Aug 06, 2012
Posts: 123

Spring used your constructor (having P and 1).

Then it set the properties (overwriting with Q and 2).

You can debug by putting System.out.println inside the constructor method, showing that the program passed that area.

The first 2 steps in a bean cycle are (from Spring In Action 3rd Edition):
1. Spring instantiates the bean.
2. Spring injects values and bean references into the bean’s properties.
3. <etc....>

-k

[SpringSource Certified Spring Professional - Practice Tests]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: @Value annotation