title: How to call a @RestController with @RequestBody?
body: <p>I have a simple servlet as follows:</p>
  
  <pre><code>@RestController
  public class TestServlet {
      @RequestMapping(value = "/test1")
      public String test1() {
          return "test1";
      }
  
      @RequestMapping(value = "/test2")
      public String test2(@RequestBody TestClass req) {
          return "test2";
      }
  
      public static class TestClass {
          private String value;
  
          public String getValue() {
              return value;
          }
  
          public void setValue(String value) {
              this.value = value;
          }
      }
  }
  </code></pre>
  
  <p>But only the servlet not receiving parameters is working:</p>
  
  <p>Works: <code>http://localhost:8080/test1</code></p>
  
  <p>Doesn't work: <code>http://localhost:8080/test2?value=1234</code></p>
  
  <blockquote>
    <p>org.springframework.http.converter.HttpMessageNotReadableException:
    Required request body is missing: public java.lang.String</p>
  </blockquote>
  
  <p>Why is the <code>@RequestBody</code> annotation not working? Am I missing an important piece?</p>