title: How to register global databinding for LocalDate in spring mvc?
body: <p>I'd like to use <code>LocalDate</code> as type in a <code>Servlet</code> created with <code>spring-mvc</code>.
  The users should be able to provide the date in multiple valid formats <code>yyyyMMdd, yyyy-MM-dd, yyMMdd, yy-MM-dd</code>.</p>
  
  <p>Therefor I'm trying to register my own converter for that class and <strong>register it globally</strong> for the whole application. But it is never picked up</p>
  
  <p>Problem: my custom editor is never called.</p>
  
  <pre><code>@Bean
  public CustomEditorConfigurer init() {
      CustomEditorConfigurer c = new CustomEditorConfigurer();
      c.setPropertyEditorRegistrars(new PropertyEditorRegistrar[] {
              (registry) -&gt; registry.registerCustomEditor(LocalDate.class, new LocalDatePropertyEditor())
      });
      return c;
  }
  
  public class LocalDatePropertyEditor extends PropertyEditorSupport {
      @Override
      public void setAsText(String text) {
          this.setValue(LocalDate.parse(text, DateTimeFormatter.ISO_DATE));
      }
  
      @Override
      public String getAsText() {
          return this.getValue().toString();
      }
  }
  
  
  @RestController
  public void DateServlet {
      @RequestMapping("/test")
      public void test(@RequestParam LocalDate date) {
  
      }
  }
  </code></pre>
  
  <p>When calling:
  <code>localhost:8080/test?date=2017-07-05</code></p>
  
  <blockquote>
    <p>Exception:
    <code>Parse attempt failed for value [2017-07-05]</code></p>
  </blockquote>
  
  <p>During debug I can see the <code>LocalDatePropertyEditor</code> class is never called. But why?</p>