title: How to use @ConstructorBinding and @PropertySource together with @ConfigurationProperties with in Spring Boot 2.2.4?
body: <p>I am new to Spring Boot. Currently, I am trying to create a POJO class (<strong>SystemProperties.class</strong>) to read the value in a properties file (<strong>parameter.properties</strong> separate from application.properties but still under the same directory /src/main/resources. The issue happens when I am using the @ConstructorBinding in the class in order for it to be immutable.</p>
  
  <blockquote>
    <ul>
    <li>@ConstructorBinding needs to be used with @EnableConfigurationProperties or @ConfigurationPropertiesScan.</li>
    <li>@ConfigurationPropertiesScan will ignore @Configuration annotation which is needed when using @PropertySource to specify external<br>
    *.properties file.</li>
    </ul>
  </blockquote>
  
  <p><strong>A) SystemProperties.class</strong></p>
  
  <pre><code>@Configuration
  @PropertySource("classpath:parameter.properties")
  
  @ConstructorBinding
  @ConfigurationProperties(prefix = "abc")
  public class SystemProperties {
  
      private final String test;
  
      public SystemProperties (
              String test) {
          this.test = test;
      }
  
      public String getTest() {
          return test;
      }
  </code></pre>
  
  <p><strong>B) parameter.properties</strong></p>
  
  <pre><code>abc.test=text1
  </code></pre>
  
  <p>I have tried to remove the @PropertySource annotation but the value cannot be retrieved unless it is from the application.properties. Any help is greatly appreciated!</p>