title: Spring MVC JodaTime conversion with @DateTimeFormat annotation
body: <p>I have a webflow project, and have a form with a DateTime field on it and I always get the following error when I submit the form and bindAndValidate:</p>
  
  <pre><code>Field error in object 'formData' on field 'requestedDeadline': rejected value [2015-03-31]; codes [typeMismatch.formData.requestedDeadline,typeMismatch.requestedDeadline,typeMismatch.org.joda.time.DateTime,typeMismatch]; arguments [org.springframework.context.support.DefaultMessageSourceResolvable: codes [formData.requestedDeadline,requestedDeadline]; arguments []; default message [requestedDeadline]]; default message [Failed to convert property value of type 'java.lang.String' to required type 'org.joda.time.DateTime' for property 'requestedDeadline'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [org.joda.time.DateTime] for property 'requestedDeadline': no matching editors or conversion strategy found], 'messagesMemento' -&gt; map[[null] -&gt; list[[empty]]], 'org.springframework.validation.BindingResult.currentFormObject' -&gt; org.springframework.validation.BeanPropertyBindingResult: 1 errors
  </code></pre>
  
  <p>Here's my servlet context:</p>
  
  <p>
  
  
  <pre><code>xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
  &lt;!-- Enables the Spring MVC @Controller programming model --&gt;
  &lt;annotation-driven /&gt;
  &lt;context:component-scan base-package="com.acme" /&gt;
  
  &lt;!-- Resolves localized messages*.properties and application.properties 
      files in the application to allow for internationalization. The messages*.properties 
      files translate Roo generated messages which are part of the admin interface, 
      the application.properties resource bundle localizes all application specific 
      messages such as entity names and menu items. --&gt;
  &lt;beans:bean
      class="org.springframework.context.support.ReloadableResourceBundleMessageSource"
      id="messageSource" p:basenames="WEB-INF/i18n/messages,WEB-INF/i18n/application"
      p:fallbackToSystemLocale="false" /&gt;
  
  &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving 
      up static resources in the ${webappRoot}/resources directory --&gt;
  &lt;resources mapping="/resources/**" location="/resources/" /&gt;
  &lt;resources mapping="/favicon.ico" location="/favicon.ico" /&gt;
  
  &lt;beans:bean id="tilesConfigurer"
      class="org.springframework.web.servlet.view.tiles3.TilesConfigurer"&gt;
      &lt;beans:property name="definitions"&gt;
          &lt;beans:list&gt;
              &lt;beans:value&gt;/WEB-INF/tiles-defs/templates.xml&lt;/beans:value&gt;
              &lt;beans:value&gt;/WEB-INF/tiles-defs/definitions.xml&lt;/beans:value&gt;
          &lt;/beans:list&gt;
      &lt;/beans:property&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean id="tilesViewResolver"
      class="org.springframework.web.servlet.view.UrlBasedViewResolver"&gt;
      &lt;beans:property name="viewClass"
          value="org.springframework.web.servlet.view.tiles3.TilesView" /&gt;
      &lt;beans:property name="order" value="900" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean id="internalResourceViewResolver"
      class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt;
      &lt;beans:property name="suffix" value=".jsp" /&gt;
      &lt;beans:property name="order" value="1000" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;beans:bean id="validator"
      class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" /&gt;
  </code></pre>
  
  <p></p>
  
  <p>Here's my webflow configuration:</p>
  
  <pre><code>&lt;beans xmlns="http://www.springframework.org/schema/beans"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:webflow="http://www.springframework.org/schema/webflow-config"
      xsi:schemaLocation="
             http://www.springframework.org/schema/beans
             http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
             http://www.springframework.org/schema/webflow-config
             http://www.springframework.org/schema/webflow-config/spring-webflow-config-2.4.xsd"&gt;
  
  
      &lt;!-- Setup Web Flow here --&gt;
      &lt;webflow:flow-registry id="flowRegistry" flow-builder-services="flowBuilderServices"&gt;
          &lt;webflow:flow-location path="/WEB-INF/flows/form-flow.xml"
              id="eform_start" /&gt;
      &lt;/webflow:flow-registry&gt;
  
      &lt;webflow:flow-builder-services id="flowBuilderServices"
          view-factory-creator="mvcViewFactoryCreator" 
          /&gt;
  
      &lt;bean id="mvcViewFactoryCreator"
          class="org.springframework.webflow.mvc.builder.MvcViewFactoryCreator"&gt;
          &lt;property name="viewResolvers"&gt;
              &lt;list&gt;
                  &lt;ref bean="tilesViewResolver" /&gt;
              &lt;/list&gt;
          &lt;/property&gt;
      &lt;/bean&gt;
  
      &lt;webflow:flow-executor id="flowExecutor" /&gt;
  
      &lt;!-- Enables FlowHandler URL mapping --&gt;
      &lt;bean class="org.springframework.webflow.mvc.servlet.FlowHandlerAdapter"&gt;
          &lt;property name="flowExecutor" ref="flowExecutor" /&gt;
      &lt;/bean&gt;
  
      &lt;bean class="org.springframework.webflow.mvc.servlet.FlowHandlerMapping"&gt;
          &lt;property name="flowRegistry" ref="flowRegistry" /&gt;
          &lt;property name="order" value="0" /&gt;
      &lt;/bean&gt;
  
  &lt;/beans&gt;
  </code></pre>
  
  <p>Here's my annotation to format the date:</p>
  
  <pre><code>@DateTimeFormat(pattern = "YYYY-MM-dd")
  @NotNull
  DateTime requestedDeadline;
  </code></pre>
  
  <p>yyyy-MM-dd does not work either.</p>
  
  <p>I'm clearly submitting the value in the correct format, but it's not working.  What am I doing wrong?</p>