title: Not able to use java.util.Duration as @Value configuration in Spring Boot
body: <p>We are not able to use java.util.Duration as @Value configuration in Spring Boot.</p>
  
  <p>Sample project that exhibits this problem here: <a href="https://github.com/costimuraru/spring-boot-sample" rel="nofollow noreferrer">https://github.com/costimuraru/spring-boot-sample</a>
  Spring Boot version: 1.5.9.RELEASE</p>
  
  <pre><code>@RestController
  public class HelloController {
  
      @Value("${mykey}")
      Duration value;
  
      @RequestMapping("/")
      public String index() {
          return "Greetings at " + value;
      }
  
  }
  
  ...
  
  public class MyConfigPropertySource extends PropertySource {
  
      MyConfigPropertySource(String name) {
          super(name);
      }
  
      @Override
      public Object getProperty(String path) {
          return "mykey".equals(path) ? Duration.ofMinutes(1) : null;
      }
  }
  </code></pre>
  
  <blockquote>
    <p>org.springframework.beans.factory.BeanCreationException: Error
    creating bean with name 'helloController': Injection of autowired
    dependencies failed; nested exception is
    org.springframework.core.convert.ConverterNotFoundException: No
    converter found capable of converting from type [java.time.Duration]
    to type [java.lang.String]    at
    org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:372)
    ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]     at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1264)
    ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]     at
    org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
    ~[spring-beans-4.3.13.RELEASE.jar:4.3.13.RELEASE]</p>
  </blockquote>
  
  <p>This error is totally unexpected: <code>No converter found capable of converting from type [java.time.Duration] to type [java.lang.String]</code>. We are not using String in neither the @Value field nor in the return statement from the PropertySource. So why is Spring Boot trying to convert it to String? Any help is gladly appreciated.</p>