title: Immutable @ConfigurationProperties
body: <p>Is it possible to have immutable (final) fields with Spring Boot's <code>@ConfigurationProperties</code> annotation? Example below</p>
  
  <pre><code>@ConfigurationProperties(prefix = "example")
  public final class MyProps {
  
    private final String neededProperty;
  
    public MyProps(String neededProperty) {
      this.neededProperty = neededProperty;
    }
  
    public String getNeededProperty() { .. }
  }
  </code></pre>
  
  <p>Approaches I've tried so far:</p>
  
  <ol>
  <li>Creating a <code>@Bean</code> of the <code>MyProps</code> class with two constructors
  <ul>
  <li>Providing two constructors: empty and with <code>neededProperty</code> argument</li>
  <li>The bean is created with <code>new MyProps()</code></li>
  <li>Results in the field being <code>null</code></li>
  </ul></li>
  <li>Using <code>@ComponentScan</code> and <code>@Component</code> to provide the <code>MyProps</code> bean.
  <ul>
  <li>Results in <code>BeanInstantiationException</code> -> <code>NoSuchMethodException: MyProps.&lt;init&gt;()</code></li>
  </ul></li>
  </ol>
  
  <p>The only way I have got it working is by providing getter/setter for each non-final field.</p>