title: Why am I getting 400 bad request with AngularJs post?
body: <p>I use Spring MVC and AngularJs to create a web application. I send a request to the server but I am getting <code>400 error bad request</code>. I configure the message converter for the json format in the Spring servlet configuration file. I am wondering why I am getting this error.</p>
  
  <p>Here is my angular service :</p>
  
  <pre><code>save : function(user) {
      return $http({
          method: 'POST',
          url: '/app-web/user/create',
          contentType: "application/json",
          data:user
      });
  }
  </code></pre>
  
  <p>And on the server side I have a Spring MVC Controller as described below : </p>
  
  <pre><code>@RequestMapping(value="/user/create", method= RequestMethod.POST)
  @ResponseBody
  public String createAccount(@RequestBody User user){
    //some logic
      return "Ok";
  }
  </code></pre>
  
  <p>I noticed something else: when I remove the <code>@RequestBody</code> in the controller I don't have a 400 error but the user is <code>null</code>:</p>
  
  <pre><code>@RequestMapping(value="/user/create", method= RequestMethod.POST)
  @ResponseBody
  public String createAccount(User user){
    //some logic
      return "Ok";
  }
  </code></pre>