Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
2.3 GA (Fowler)
-
None
Description
We have a Spring Data REST project, with several @RepositoryRestResource annotated Spring Data Repositories.
Example:
@RepositoryRestResource(path = "person") public interface PersonRepository extends PagingAndSortingRepository<Person, Integer> {}
We want to override the POST/PATCH method of one of these repositories. So we annotate a RestController with @RestController and the annotation @RequestMapping has the same path as the repository.
Example:
@RestController @RequestMapping("person") public class PersonController{ @RequestMapping(method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE) public ResponseEntity<Boolean> savePerson(@RequestBody Person person) { ... }
The POST/PATCH works fine. But now a GET to /person (to receive all Persons) throws an HttpRequestMethodNotSupportedException and says: Request method 'GET' not supported.
A GET to /person/1 instead is working just fine.
We had a look at https://jira.spring.io/browse/DATAREST-490 and the @BasePathAwareController, but this doesnt seem to change anything.
Attachments
Issue Links
- is related to
-
DATAREST-490 Repository controllers not invoked if resource is handled manually in dedicated media type
-
- Closed
-