title: Spring MVC: HTTP 405 - Request method 'GET' not supported when making POST request
body: <p>Just started a default Spring MVC project, and I'm not able to get the POST requests handler to work. This is my controller:</p>
  
  <pre><code>package com.myapp.controller;
  
  import org.springframework.stereotype.Controller;
  import org.springframework.web.bind.annotation.RequestMapping;
  import org.springframework.web.bind.annotation.RequestMethod;
  import org.springframework.web.bind.annotation.ResponseBody;
  
  import com.myapp.domain.Response;
  
  @Controller
  public class MyAppController {
  
      @RequestMapping(value = "/", method = RequestMethod.POST)
      @ResponseBody
      public Response query() {
          return new Response();
      }
  }
  </code></pre>
  
  <p>Response is a simple POJO like this:</p>
  
  <pre><code>package com.myapp.domain;
  
  public class Response {
  
      private String text;
      private String ref;
  
      public Response() {}
  
      public String getText() {
          return text;
      }
  
      public void setText(String text) {
          this.text = text;
      }
  
      public String getRef() {
          return ref;
      }
  
      public void setRef(String ref) {
          this.ref = ref;
      }
  }
  </code></pre>
  
  <p>servlet-context.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;beans:beans xmlns="http://www.springframework.org/schema/mvc"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xmlns:beans="http://www.springframework.org/schema/beans"
  xmlns:context="http://www.springframework.org/schema/context"
  xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
      http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"&gt;
  
  &lt;!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure --&gt;
  
  &lt;!-- Enables the Spring MVC @Controller programming model --&gt;
  &lt;annotation-driven /&gt;
  
  &lt;!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory --&gt;
  &lt;resources mapping="/resources/**" location="/resources/" /&gt;
  
  &lt;!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory --&gt;
  &lt;beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"&gt;
      &lt;beans:property name="prefix" value="/WEB-INF/views/" /&gt;
      &lt;beans:property name="suffix" value=".jsp" /&gt;
  &lt;/beans:bean&gt;
  
  &lt;context:component-scan base-package="com.myapp" /&gt;
  
  
  
  &lt;/beans:beans&gt;
  </code></pre>
  
  <p>Jackson is declared as a dependency in pom.xml.</p>
  
  <p>When I make a POST request (through Postman), tomcat returns <code>HTTP 405 - Request method 'GET' not supported</code>. Is there any configuration to get tomcat responding to POST requests?</p>