title: Spring Rest Controller POST request doesn't work
body: <p>I have a rest controller:</p>
  
  <pre><code>@RestController
  @RequestMapping("/query")
  public class QueryController {
  
      @Autowired
      private QueryService queryService;
  
      @RequestMapping(value = "/select", method = RequestMethod.POST)
      public @ResponseBody QueryResultDTO executeQuery(@RequestBody QueryDTO queryDTO) {
          try {
              QueryResultDTO queryResultDTO = queryService.executeQuery("select * from employees");
              queryResultDTO.setSuccessful(true);
              return queryResultDTO;
          } catch (SQLException e) {
              QueryResultDTO queryResultDTO = new QueryResultDTO();
              queryResultDTO.setSuccessful(false);
              queryResultDTO.setErrorMessage(e.getMessage());
              return queryResultDTO;
          }
      }
  }
  </code></pre>
  
  <p>and I try to send POST request from AngularJS controller:</p>
  
  <pre><code>app.controller("AppCtrl",function($scope,$http) {
      var app = this;
  
      $scope.execute= function () {
          $http({
              url: '../query/select',
              method: "POST",
              data: { 'message' : $scope.queryText }
          })
              .then(function(response) {
                      $scope.queryResult = response.data;
                      console.log($scope.queryResult);
                      console.log($scope.queryText)
                  },
                  function(response) {
                      console.log(response);
                  });
      }
  
  });
  </code></pre>
  
  <p>but It doesn't work. My <code>executeQuery</code> function in Spring Controller isn't even called.</p>
  
  <p>But when I change RequestMethod to GET it works correctly.</p>
  
  <pre><code>@RestController
  @RequestMapping("/query")
  public class QueryController {
  
      @Autowired
      private QueryService queryService;
  
      @RequestMapping(value = "/select", method = RequestMethod.GET)
      public @ResponseBody QueryResultDTO executeQuery() {
          try {
              QueryResultDTO queryResultDTO = queryService.executeQuery("INSERT INTO employee VALUES (7,'dupa')");
              queryResultDTO.setSuccessful(true);
              return queryResultDTO;
          } catch (SQLException e) {
              QueryResultDTO queryResultDTO = new QueryResultDTO();
              queryResultDTO.setSuccessful(false);
              queryResultDTO.setErrorMessage(e.getMessage());
              return queryResultDTO;
          }
      }
  }
  </code></pre>
  
  <p>and in Angular controller:</p>
  
  <pre><code>app.controller("AppCtrl",function($scope,$http) {
      var app = this;
  
      $scope.execute= function () {
          $http({
              url: '../query/select',
              method: "GET",
              data: { 'message' : $scope.queryText }
          })
              .then(function(response) {
                      $scope.queryResult = response.data;
                      console.log($scope.queryResult);
                      console.log($scope.queryText)
                  },
                  function(response) {
                      console.log(response);
                  });
      }
  
  });
  </code></pre>
  
  <p>My main problem is that I'd like to send some data to my Spring controller and then send <code>JSON</code> in response to my Angular controller. Whith <code>GET</code> method response works perfectly, but when I use <code>POST</code> the controller method isn't even called.</p>
  
  <p>Edit:</p>
  
  <p>My <code>QueryDTO</code> class is simple:</p>
  
  <pre><code>public class QueryDTO {
  
      private String message;
  
      public String getMessage() {
          return message;
      }
  
      public void setMessage(String message) {
          this.message = message;
      }
  }
  </code></pre>
  
  <p>And some logs with <code>DEBUG</code> level:</p>
  
  <pre><code>2016-06-06 09:28:23.697 DEBUG 7504 --- [nio-8090-exec-2] o.s.web.servlet.DispatcherServlet        : Null ModelAndView returned to DispatcherServlet with name 'dispatcherServlet': assuming HandlerAdapter completed request handling
  2016-06-06 09:28:23.698 DEBUG 7504 --- [nio-8090-exec-2] o.s.web.servlet.DispatcherServlet        : Successfully completed request
  </code></pre>