title: Testing @ConfigurationProperties annotation without loading spring context
body: <p>I'm trying to test a class that has the <code>@ConfigurationProperties</code> annotation but without loading the entire spring context. I tried using only the JUnit5's features in order to do that but until now didn't succeed in that.</p>
  <p>I'm using <code>spring-boot-starter-parent</code> v2.6.2 .</p>
  <p>The class I'm testing :</p>
  <pre><code>@ConfigurationProperties(&quot;db.mongo&quot;)
  @AllArgsConstructor
  @NoArgsConstructor
  @Getter
  @Setter
  public class MongoProperties {
      private String host;
      private String db;
      private String user;
      private String password;
  }
  </code></pre>
  <p>The application.yaml :</p>
  <pre><code>db:
    mongo:
      host: localhost
      db: test
      user: test-user
      password: secret
  </code></pre>
  <p>My Test class :</p>
  <pre><code>@ExtendWith(SpringExtension.class)
  @EnableConfigurationProperties({MongoProperties.class})
  public class MongoPropertiesTest {
  
      @Autowired
      private  MongoProperties properties;
  
      @Test
      public void mongoPropertiesLoadedTest(){
          assertNotNull(properties.getDb());
          assertNotNull(properties.getHost());
          assertNotNull(properties.getPassword());
          assertNotNull(properties.getUser());
      }
  }
  </code></pre>
  <p>The <code>MongoProperties</code> bean is injected successfully, but all the values inside are null and the asserts fail.</p>
  <p>Adding the <code>@SpringBootTest</code> solves the issue of the null values in the instance of the bean, but it also starts the whole spring context which is what I DONT want.</p>