PUT request in Spring MVC
<p>I'm trying to write a simple <code>PUT</code> request method in Spring MVC. I got the following:</p>

<pre><code>@RequestMapping(value = "/users/{id}", method = RequestMethod.PUT) 
public @ResponseBody User updateUser(@PathVariable("id") long id, 
                                     String name, 
                                     String email) {
        User user = repository.findOne(id);
        user.setName(name);
        user.setEmail(email);
        System.out.println(user.toString());
        repository.save(user);
        return user; 
} 
</code></pre>

<p>Which is obviously wrong, because it returns the following:</p>

<pre><code>User{id=1, name='null', email='null'}
</code></pre>

<p>I also tried with <code>@RequestBody</code> annotation, but that also did not help. Any ideas what I'm doing wrong here would be greatly appreciated. </p>