Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@Value annotation

 
pramod talekar
Ranch Hand
Posts: 328
Eclipse IDE Java Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

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



Thanks.
 
Kathleen Angeles
Ranch Hand
Posts: 123
Firefox Browser Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic