title: Usage of Spring @ConfigurationProperties gives nullpointer when running tests, JHipster app
body: <p>Hi I have implemented a simple file upload routine using spring boot ConfigurationProperties annotation so I can load the directory from my yaml configuration file: </p>
  
  <p>Service: </p>
  
  <pre><code>@Service
  public class FileSystemStorageService implements StorageService {
  
  private final Logger log = LoggerFactory.getLogger(FileSystemStorageService.class);
  
  private final Path pictureLocation;
  
  @Autowired
  public FileSystemStorageService(StorageProperties storageProperties) {
      pictureLocation = Paths.get(storageProperties.getUpload());
  }
  </code></pre>
  
  <p>And the StorageProperties: </p>
  
  <pre><code>@Component
  @ConfigurationProperties("nutrilife.meals")
  public class StorageProperties {
  
      private String upload;
  
      public String getUpload() {
          return upload;
      }
  
      public void setUpload(String upload) {
          this.upload= upload;
      }
  }
  </code></pre>
  
  <p>In the yaml file I have: </p>
  
  <pre><code>nutrilife:
      meals:
          upload: /$full_path_to_my_upload_dir
  </code></pre>
  
  <p>This works perfectly in normal spring boot runtime but the problem starts when I try to run my integration tests, it throws the error: </p>
  
  <pre><code>java.lang.IllegalStateException: Failed to load ApplicationContext
  ...
  Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'fileSystemStorageService' defined in file [/home/mmaia/git/nutrilife/build/classes/main/com/getnutrilife/service/upload/FileSystemStorageService.class]: Bean instantiation via constructor failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.getnutrilife.service.upload.FileSystemStorageService]: Constructor threw exception; nested exception is java.lang.NullPointerException
  at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:279)
  
  ...
  Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.getnutrilife.service.upload.FileSystemStorageService]: Constructor threw exception; nested exception is java.lang.NullPointerException
  at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)
  </code></pre>
  
  <p>So basically during tests the yaml file configuration looks like it's not being properly picked up. I am new to Spring and I've been stuck with this issue for a couple of hours, not sure how to fix it. Any ideas? </p>
  
  <p>Thanks.</p>