title: How to spring inject configuration value for Joda Period
body: <p>How can I use the @Value annotation to configure a Joda-Time <em>Period</em> field in my spring bean?</p>
  
  <p>E.g. Given the following component class:</p>
  
  <pre><code>@Component
  public class MyService {
  
    @Value("${myapp.period:P1D}")
    private Period periodField;
  ...
  }
  </code></pre>
  
  <p>I want to use standard ISO8601 format to define the period in a properties file.</p>
  
  <p>I get this error:</p>
  
  <pre><code>Caused by: java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.joda.time.Period]: no matching editors or conversion strategy found
      at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:302)
      at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:125)
      at org.springframework.beans.TypeConverterSupport.doConvert(TypeConverterSupport.java:61)
      ... 35 more
  </code></pre>