title: @Value can reads, but @ConfigurationProperties can't
body: <p>I'm trying to read a yml file like this.</p>
  
  <pre><code>order:
    foo: 5000
    bar: 12
  </code></pre>
  
  <p>and I can read it with <code>@value</code>. (I'm using Lombok btw)</p>
  
  <pre><code>@Component
  @Data
  public class WebConfigProperty {
  
      private Integer foo;
      private Integer bar;
  
      public WebConfigProperty(@Value("${order.foo}") @NonNull final Integer foo,
              @Value("${order.bar}") @NonNull final Integer bar) {
          super();
          this.foo = foo;
          this.bar = bar;
      }
  }
  </code></pre>
  
  <p>I'm trying to use <code>@ConfigurationProperties</code> since the yml file is going to be more complexed. But it doesn't work with <code>@ConfigurationProperties</code>.</p>
  
  <pre><code>@Component
  @ConfigurationProperties("order")
  @Data
  public class WebConfigProperty {
  
      @NonNull
      private Integer foo;
      @NonNull
      private Integer bar;
  }
  </code></pre>
  
  <p>I also added <code>@EnableConfigurationProperties</code> in a config class. All annotations in the config are like this.</p>
  
  <pre><code>@SpringBootConfiguration
  @EnableConfigurationProperties
  @EnableAutoConfiguration(exclude = { ... })
  @ComponentScan(basePackages = { ... })
  @Import({ ... })
  @EnableCaching
  </code></pre>
  
  <p>Error messages are like this.</p>
  
  <pre><code>***************************
  APPLICATION FAILED TO START
  ***************************
  
  Description:
  
  Parameter 0 of constructor in {...}.WebConfigProperty required a bean of type 'java.lang.Integer' that could not be found.
  
  
  Action:
  
  Consider defining a bean of type 'java.lang.Integer' in your configuration.
  </code></pre>
  
  <p>It seems like Spring can't find the yml file and trying to put null values into the <code>WebConfigProperty</code> fields. I don't know why.</p>
  
  <p>FYI, this is a multi-project application using Gradle. The yml file and a configuration class(not written) are in the same project. <code>WebConfigProperty</code> is on another project.</p>
  
  <p><strong>EDIT:</strong>
  Based on @Yannic Klem's answer, this two worked.</p>
  
  <pre><code>@Component
  @ConfigurationProperties("order")
  @Getter
  @Setter
  @EqualsAndHashCode
  public class WebConfigProperty {
  
      @NonNull
      private Integer foo;
      @NonNull
      private Integer bar;
  }
  
  //OR
  
  @Component
  @ConfigurationProperties("order")
  @Data
  @NoArgsConstructor
  public class WebConfigProperty {
  
      @NonNull
      private Integer foo;
      @NonNull
      private Integer bar;
  }
  </code></pre>