Spring Data REST PUT Method Not Allowed
java, rest, spring, spring-data, spring-mvc
Solution
You are trying to use the same url for `POST` and `PUT` requests, but `PUT` usually requires the id of the object that has to be updated.
Spring does have mapping for `localhost:8080/<applicationname>/<entityName>`, but only for `POST` request and hence the error.
Try using `PUT` with:
http://localhost:8080/<applicationname>/<entityName>/<objectId>
Problem
I recently implemented Spring Data REST (http://www.springsource.org/spring-data/rest) in order to expose CRUD functionality through a REST interface automatically. GET and POST both work as expected, however I'm getting a 405 Method Not Allowed when using the PUT Verb. According to the documentation ``` Verb Method GET CrudRepository<ID,T>.findOne(ID id) POST CrudRepository<ID,T>.save(T entity) PUT CrudRepository<ID,T>.save(T entity) DELETE CrudRepository<ID,T>.delete(ID id) ``` By default, all of these methods are exported to clients. I've read through the documentation here (http://static.springsource.org/spring-data/rest/docs/1.1.0.M1/reference/htmlsingle/) but can't seem to find a reason for this behaviour. Can anyone suggest where I might have gone wrong? I have provided a RepositoryRestMvcConfiguration class which defines resource mapping for all my Entity classes.