title: How to inject java.nio.file.Path dependency using @ConfigurationProperties
body: <p>I'm using Spring Boot and have the following Component class:</p>
  
  <pre><code>@Component
  @ConfigurationProperties(prefix="file")
  public class FileManager {
  
      private Path localDirectory;
  
      public void setLocalDirectory(File localDirectory) {
          this.localDirectory = localDirectory.toPath();
      }
  
  ...
  
  }
  </code></pre>
  
  <p>And the following yaml properties file:</p>
  
  <pre><code>file:
       localDirectory: /var/data/test
  </code></pre>
  
  <p>I would like to remove the reference of java.io.File (of setLocalDirectory) by replacing with java.nio.file.Path. However, I receive a binding error when I do this. Is there way to bind the property to a Path (e.g. by using annotations)? </p>