Spring Data Rest supporting json and xml

1.2k Views Asked by At

Is it possible to have spring data rest repositories supporting both json and xml at the same time? I was hoping that something like that would work (but it doesn't unfortunately):

@RequestMapping(produces = { "application/json", "application/xml" })
@RepositoryRestResource
1

There are 1 best solutions below

1
On

What you need is to configure content negotiation in Spring Web MVC.

Follow this blog post for more information.