title: Getting JSON Post to work in Spring Boot
body: <p>I'm trying to make a POST call with JSON to a Spring Boot app that I am running, and I keep getting the following error each time I make a POST call</p>
  
  <pre><code>Request method 'POST' not supported
  </code></pre>
  
  <p>Here is the basic layout of my controller,</p>
  
  <pre><code>@RestController
  public class MessagesController {
  
      @RequestMapping(value = "/messages", method = RequestMethod.POST)
      public @ResponseBody Answer processMessage(@RequestBody Message message) throws Exception{
          System.out.println("HERE");
  
          Answer a = new Answer(5);
  
          return a;
      }
  
      @ExceptionHandler
      void handleException(Exception e, HttpServletResponse response) throws IOException {
          response.sendError(HttpStatus.CONFLICT.value());
      }
  }
  </code></pre>
  
  <p><code>Message</code> and <code>Answer</code> are POJOs</p>
  
  <pre><code>public class Message implements Serializable{
      private int id;
      private int description;
  
      public int getId() {
          return id;
      }
      public void setId(int id) {
          this.id = id;
      }
      public String getDescription() {
          return description;
      }
      public void setDescription(String description) {
          this.description= description;
      }
  }
  
  public class Answer implements Serializable{
      private int answer;
  
      public Answer(int answer){
          this.answer = answer;
      }
  
      public int getAnswer() {
          return answer;
      }
  
      public void setAnswer(int answer) {
          this.answer = answer;
      }
  }
  </code></pre>
  
  <p>I'd like to be able to POST JSON to my controller, and then receive a JSON message back. How do I get this to work, without the error? I am posting to <code>http://localhost:8080/messages</code> through SoapUI</p>