title: Default value as Duration at @Value
body: <p>I need to specify <em>default value</em> for an instance variable which is of type <em>java.time.Duration</em></p>
  
  <p>The default value which I pass is being read as String, causing IllegalStateException</p>
  
  <p>My class</p>
  
  <pre><code>public class Test {
    @Value("${kafka.consumer.commit.interval:5s}")
    private Duration commitInterval;
  
    .
    .
    .
  
  }
  </code></pre>
  
  <p>Exception:</p>
  
  <pre><code>  Unsatisfied dependency expressed through field 'commitInterval'; 
    nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert value of type 'java.lang.String' to required type 'java.time.Duration'; 
    nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'java.time.Duration': no matching editors or conversion strategy found
  </code></pre>