title: Trouble with getting form data using Spring
body: <p>I am super new to front end development.  I have a simple webapp where you can submit a form, and I want to be able to get the form data in a REST endpoint. I am using Spring boot which contains Spring MVC.</p>
  
  <p>The HTML: </p>
  
  <pre><code>&lt;div class="modal-header modal-header-info"&gt;
      &lt;button type="button" class="close" data-dismiss="modal"
          aria-hidden="true"&gt;&amp;times;&lt;/button&gt;
      &lt;h4 class="modal-title"&gt;Add Entity&lt;/h4&gt;
  &lt;/div&gt;
  &lt;div class="modal-body"&gt;
      &lt;form role="form" method="post" action="/createEntity"&gt;
          &lt;div class="form-group"&gt;
              &lt;label for="name"&gt;Name:&lt;/label&gt; &lt;input type="text"
                  class="form-control" id="name"&gt;
          &lt;/div&gt;
          &lt;button type="submit" class="btn btn-info"&gt;Submit&lt;/button&gt;
      &lt;/form&gt;
  &lt;/div&gt; 
  </code></pre>
  
  <p>The Java:</p>
  
  <pre><code>@RequestMapping(value = "/createEntity", method = RequestMethod.POST)
  public void createEntity(@RequestBody String payload) {
      System.out.println("Hello world!");
      System.out.println(payload);
  }
  </code></pre>
  
  <p>I get this error back:</p>
  
  <pre><code>Failed to read HTTP message:
             org.springframework.http.converter.HttpMessageNotReadableException: 
             Required request body is missing: public void    main.java.info.spring.data.neo4j.controllers.CreateEntityController.createEntity(java.lang.String)
  </code></pre>
  
  <p>How do I get the "name" value from the form? The "hello world" attribute prints out if I take out the @RequestBody part.</p>
  
  <p>Edit: my configuration per request:</p>
  
  <pre><code>@EnableTransactionManagement
  @Import(RepositoryRestMvcConfiguration.class)
  @EnableScheduling
  @EnableAutoConfiguration
  @ComponentScan(basePackages = { "main.java.info.spring.data.neo4j.services",
          "main.java.info.spring.data.neo4j.controllers" })
  @Configuration
  @EnableNeo4jRepositories(basePackages = "main.java.info.spring.data.neo4j.repositories")
  public class MyNeo4jConfiguration extends Neo4jConfiguration {
  
      public static final String URL = System.getenv("NEO4J_URL") != null ? System.getenv("NEO4J_URL")
              : "http://localhost:7474";
  
      @Override
      public Neo4jServer neo4jServer() {
          return new RemoteServer(URL, "neo4j", "LOL my pass");
  
      }
  
      @Override
      public SessionFactory getSessionFactory() {
          return new SessionFactory("main.java.info.spring.data.neo4j.domain");
      }
  }
  </code></pre>