title: Inject value from properties in Spring Boot
body: <p>I have a Rest Controller in which I initialise a service like this :</p>
  
  <pre><code>class Config {
    @Value(${"number.of.books"})
    private final static String numberOfBooks;
  }
  
  
  class MyController  {
  
   private final Service myService = new ServiceImplementation(Config.numberOfBooks)
  
   public ResponseEntity methodA() { ... }
  
  }
  </code></pre>
  
  <p>The <code>numberOfBooks</code> field has a initialisation value but when it's passed in the <code>ServiceImplementation</code> constructor it comes null.</p>
  
  <p>I'm thinking I'm missing something obvious over here. </p>
  
  <p>What is the mistake and which would be the best practice to inject a value from a property file into a constructor?</p>