title: Getting null values when using ConfigurationProperties on Spring boot
body: <p>I'm new to the Java world and Spring boot, and I'm trying to access some configuration values located in a YAML file through the <code>ConfigurationProperties</code> annotation.</p>
  
  <p>But whenever I try to access a configuration value anywhere in a service, I get a null value.</p>
  
  <p>Here's the <code>application.yml</code> file:</p>
  
  <pre><code>my_config:
    test: "plop"
  </code></pre>
  
  <p>Here's the <code>ValidationProperties</code> configuration class:</p>
  
  <pre><code>@Configuration
  @ConfigurationProperties(prefix = "my_config")
  public class ValidationProperties {
  
      @NotNull
      private String test;
  
      public void setTest(String test) {
          this.test = test;
      }
  
      public String getTest() {
          return this.test;
      }
  }
  </code></pre>
  
  <p>A validator service that uses it:</p>
  
  <pre><code>@Service
  public class MyValidator implements ConstraintValidator&lt;MyConstraint, MyEntity&gt; {
  
      @Autowired
      private ValidationProperties validationProperties;
  
      @Value("${my_config.test}")
      private String test;
  
      @Override
      public boolean isValid(MyEntity entity, ConstraintValidatorContext context) {
  
          System.out.println(this.test); // null value, why?
      }
  }
  </code></pre>
  
  <p>I also added the <code>@EnableConfigurationProperties</code> annotation in my main class. </p>
  
  <p>I'm not sure which annotation is supposed to do what, but I'm obviously missing something here. Also, if I try to access the value from the getter of the configuration file, I get an exception:</p>
  
  <pre><code>System.out.println(this.validationProperties.getTest());
  </code></pre>
  
  <p>will get me <code>HV000028: Unexpected exception during isValid call.</code></p>