title: What difference does @EnableConfigurationProperties make if a bean is already annotated with @ConfigurationProperties?
body: <p><a href="https://docs.spring.io/spring-boot/docs/2.1.3.RELEASE/reference/html/boot-features-external-config.html#boot-features-external-config-typesafe-configuration-properties" rel="noreferrer">The Spring Boot documentation</a> says that to use the <code>@ConfigurationProperties</code> annotation</p>
  <blockquote>
  <p>You also need to list the properties classes to register in the
  <code>@EnableConfigurationProperties</code> annotation, as shown in the following
  example:</p>
  </blockquote>
  <p>and gives this code:</p>
  <pre class="lang-java prettyprint-override"><code>@Configuration
  @EnableConfigurationProperties(AcmeProperties.class)
  public class MyConfiguration {
  }
  </code></pre>
  <p>But in the very next paragraph says:</p>
  <blockquote>
  <p>Even if the preceding configuration creates a regular bean for
  AcmeProperties, we recommend that <code>@ConfigurationProperties</code> only deal
  with the environment and, in particular, does not inject other beans
  from the context. Having said that, the <code>@EnableConfigurationProperties</code>
  annotation is also automatically applied to your project so that any
  <em>existing</em> bean annotated with <code>@ConfigurationProperties</code> is configured
  from the <code>Environment</code>.</p>
  </blockquote>
  <p>Suggesting that listing a <code>@ConfigurationProperties</code> bean under an <code>@EnableConfigurationProperties</code> annotation is not necessary.</p>
  <p>So which is it? Experimentally, I've seen that if I annotate a bean with <code>@ConfigurationProperties</code> it gets properties injected to it as expected without needing to list it in <code>@EnableConfigurationProperties</code>, but if this is the case then why list anything that has a <code>@ConfigurationProperties</code> annotation under <code>@EnableConfigurationProperties</code>, as is shown in the documentation? Does it make any kind of difference?</p>