title: Response for preflight has invalid HTTP status code 405 - AngularJS + Spring MVC
body: <p>I'm trying to make a Post request here but not succeeding with it.</p>
  
  <p>Angularjs code:</p>
  
  <pre><code>function Login(username, password, callback) {
  
        $http.post('http://localhost:8080/basic-web-app/login', { username: username, password: password })
  
              .success(function (response) {
                  console.log(response);
                         callback(response);
              });
  
      }
  </code></pre>
  
  <p>Server code: </p>
  
  <pre><code>@RequestMapping(value =  "/login", method = RequestMethod.GET)
  public String login(@RequestBody Login login) {
      if (login.username.equals("test") &amp;&amp; login.password.equals("test")) {
          return "success";
      } else {
          return "not success";
      }
  }
  </code></pre>
  
  <p>Error: XMLHttpRequest cannot load <code>http://localhost:8080/basic-web-app/login</code>. Response for preflight has invalid HTTP status code 405</p>