I have class:
@RepositoryRestController
@RequestMapping(value = "users")
public class UserController {
...other methods...
@GetMapping(value = "returnText", produces = MediaType.TEXT_PLAIN_VALUE)
public String returnText() {
return "my text";
}
}
And when this method is called by Postman, http response content-type header is application/hal+json but I used produces = MediaType.TEXT_PLAIN_VALUE
.
Can I somehow change content-type
header of response?
Can @RepositoryRestController
only return application/hal+json
?
I wanted to use @RepositoryRestController
to return image/jpg
contet-type also in another method and that does not work because of same reason.
I think this will work in @RestController
class but why use that if my application is Spring Data Rest and I want to use @RepositoryRestController
annotation for my controllers.