1
は、私は次のメソッドを持つスプリングRepositoryRestControllerを持っています。 春ブートデータの残りのポストエンティティ
は、例えばEntityクラスは次のようになります。public Entity {
Long id;
String firstField;
String secondField;
EntityB relatedEntity;
}
ポスティングはそのフィールドの値を、以下で、エンティティのinstaceにエンドポイントデシリアライズになります
{
id: 1,
firstField: "someThing",
secondField: "BUMP",
relatedEntity: "<root>/api/entityB/1:
}
をエンドポイントするJSONを次
Entity:
id = null
firstfield = "someThing"
secondField = "BUMP",
relatedEntity = instance of EntityB.class with everything related
私が期待するものは:
Entity:
id = 1
firstfield = "someThing"
secondField = "BUMP",
relatedEntity = instance of EntityB.class with everything related
質問にはどのように値を設定するのですか?
_links [self、entity ...]のすべての組み合わせを試しました。
これは正しいです。しかし、我々はアイデアがクライアント側にのみ自己のURLを公開していないという考えに従っている場合。あなたは私のために関係からそれを回復するために春のブートを提供する方法を知っていますか? – notanormie
これは関連しているようです:https://stackoverflow.com/questions/24936636/while-using-spring-data-rest-after-migrating-an-app-to-spring-boot-i-have-obser – brub
これはそれ以外の方法では、exposingIdsはクライアントに送信するためですが、私が達成しようとしているのはidを持つJSONからオブジェクトを逆シリアル化することです。 – notanormie