title: Spring Boot + LocalDate: "No primary or default constructor"
body: <p>I have created a simple form with an <code>&lt;input type="date" ...&gt;</code> for a Spring Boot application. I'd like that turned into a <code>LocalDate</code> in the controller. I get the error:</p>
  
  <pre><code>Fri Aug 17 15:32:01 CEST 2018
  There was an unexpected error (type=Internal Server Error, status=500).
  No primary or default constructor found for class java.time.LocalDate
  </code></pre>
  
  <p>That is certainly correct, but - as far as I understand - should not matter, because, according to the documentation: "[...] the <code>@DateTimeFormat</code> annotation should work with <code>java.time</code> on Java 8 and Spring 4."</p>
  
  <p>Controller method:</p>
  
  <pre><code>@PostMapping("/users")
  public String register(String user, String pw, @DateTimeFormat(iso=DateTimeFormat.ISO.DATE) LocalDate beginning){
  
      MyUser myUser = MyUser.create(user,pw);
      MyUser.setEnabled(beginning);
  
      repo.register(myUser);
  
      return "redirect:/users/"+user;
  }
  </code></pre>
  
  <p>html/thymeleaf:</p>
  
  <pre><code>&lt;form method="POST"&gt;
  &lt;div&gt;&lt;label&gt; Benutzername : &lt;input type="text" name="user"/&gt; &lt;/label&gt;&lt;/div&gt;
  &lt;div&gt;&lt;label&gt; Passwort: &lt;input type="password" name="password"/&gt; &lt;/label&gt;&lt;/div&gt;
  &lt;div&gt;&lt;label&gt; Freigeschaltet ab (optional): &lt;input type="date" name="beginning"/&gt; &lt;/label&gt;&lt;/div&gt;
  &lt;div&gt;&lt;input type="submit" value="Registrieren"/&gt;&lt;/div&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>pom (excerpt)</p>
  
  <pre><code> &lt;dependencyManagement&gt;
      &lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
              &lt;artifactId&gt;spring-boot-dependencies&lt;/artifactId&gt;
              &lt;version&gt;2.0.4.RELEASE&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
              &lt;scope&gt;import&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  &lt;/dependencyManagement&gt;
  
  &lt;dependencies&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-thymeleaf&lt;/artifactId&gt;
      &lt;/dependency&gt;
      &lt;dependency&gt;
          &lt;groupId&gt;org.springframework.boot&lt;/groupId&gt;
          &lt;artifactId&gt;spring-boot-starter-web&lt;/artifactId&gt;
      &lt;/dependency&gt;
  ...
  &lt;/dependencies&gt;   
  
  &lt;properties&gt;
      &lt;java.version&gt;1.8&lt;/java.version&gt;
  &lt;/properties&gt;
  </code></pre>
  
  <p>Edit: Complete html</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
    xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity3"&gt;
  &lt;head&gt;
  &lt;title&gt;Users&lt;/title&gt;
  &lt;/head&gt;
  &lt;body&gt;
  
  &lt;div th:insert="fragments :: logoutButton"&gt;...&lt;/div&gt;
  
  &lt;div class ="user_list"&gt;
  &lt;h2&gt;Registrierte Nutzer&lt;/h2&gt;
  
  &lt;div&gt;
  &lt;table border="1"&gt;
      &lt;tr&gt;
          &lt;td&gt;Name&lt;/td&gt;
          &lt;td&gt;Freigeschaltet ab&lt;/td&gt;
          &lt;td&gt;Freigeschaltet bis&lt;/td&gt;
          &lt;td&gt;Passwort gesetzt&lt;/td&gt;
          &lt;td&gt;Freigaben&lt;/td&gt;
      &lt;/tr&gt;
      &lt;tr th:each="user : ${users}"&gt;
          &lt;td th:text="${user.userName}"/&gt;
          &lt;td th:text="${user.enabled}"/&gt;
          &lt;td th:text="${user.disabled}"/&gt;
          &lt;td th:text="${user.pwSet}"/&gt;
          &lt;td th:text="${user.authorities}"/&gt;
      &lt;/tr&gt;
  &lt;/table&gt;
  &lt;/div&gt;
  &lt;/div&gt;
  
  &lt;div class ="register_user"&gt;
  &lt;h2&gt;Neuen Benutzer Registrieren&lt;/h2&gt;
  
  &lt;form method="POST"&gt;
  &lt;div&gt;&lt;label&gt; Benutzername : &lt;input type="text" name="user"/&gt; &lt;/label&gt;    &lt;/div&gt;
  &lt;div&gt;&lt;label&gt; Password: &lt;input type="password" name="password"/&gt; &lt;/label&gt;&lt;/div&gt;
  &lt;div&gt;&lt;label&gt; Freigeschaltet ab (optional): &lt;input type="date" name="beginning"/&gt; &lt;/label&gt;&lt;/div&gt;
  &lt;div&gt;&lt;input type="submit" value="Registrieren"/&gt;&lt;/div&gt;
  &lt;/form&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>