• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

@Value can be used with methods only if annotated with @Autowired. Is that correct?

 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
From book Getting started with Spring framework -4th edition, I came across this sentence (page 180):

You should note that @Value annotation can be used at method-level and method-parameter-level only if the method is annotated with @Autowired, @Resource or @Inject annotation.



So, I gave it a shot:

What I get it:


-First notice is that book was incorrect as it worked for method-level.
-Second notice and question is how does it work when @Value is at method-level and doesn't work when @Value is inside method-parameters? What happens behind the scenes?
 
reply
    Bookmark Topic Watch Topic
  • New Topic