4

I'm trying to set the spring data rest response to be only json and not HATEOS.

I tried placing this rule in application.properties but did not work. The manual only displays

defaultMediaType - change default media type to use when none is specified

Every other configuration from application.properties is being loaded only this one is not being followed.

spring.data.rest.defaultMediaType=application/json
Azzabi Haythem
  • 2,318
  • 7
  • 26
  • 32
Fernando André
  • 1,213
  • 3
  • 19
  • 32

1 Answers1

0

This was answered quoting gyoder: Optionally disable HATEOAS format in Spring Data Rest

The short answer is, you can't use spring-data-rest without hateoas. If you want to build your web service without hateoas, you'll have to write your own controllers (which can still use spring-data repositories).

Quoting Oliver Gierke in this SO post:

Actually my whole point is: the server is just doing decent REST. If that breaks the client, it's the client that needs to be fixed (tweaked). So the hypermedia aspect is a fundamental one to Spring Data REST and we're not going to back out of that. That's probably not satisfying in your concrete situation but should answer the question at least :). – Oliver Gierke

cyberoblivion
  • 669
  • 7
  • 23