my project is moving away from a custom json format to json-hal and spring-data-rest. to continue the support for the "old" json i want to run the existing Resource-Controller parallel to the new Spring-Data-Rest provided one.
Whenever i configure spring-data-rest to use the same url as our existing controller ONLY the old controller is used and if the accept-header does not match i get an error response. when i use a different url, everything works
Is it possible to run a controller in parallel to the spring-data-rest one and respond based on the Accept-Header?
The old Controller:
@RepositoryRestController
@RequestMapping(value = "/api/accounts", produces = {"application/custom.account+json"})
public class AccountResource {
@RequestMapping(method = RequestMethod.GET)
@PreAuthorize("#oauth2.hasScope('read') and hasRole('ROLE_ADMIN')")
public ResponseEntity<List<Account>> getAll(
@RequestParam(value = "page", required = false) Integer offset,
@RequestParam(value = "per_page", required = false) Integer limit,
@RequestParam(value = "email", required = false) String email
) throws URISyntaxException {
...
}
}