Skip to content

Spring Boot 4 - Spring Data REST does not support URI strings in JSON for associations in Post Request Anymore #48379

@fdlessard

Description

@fdlessard

I've migrated my Spring Boot 3.5.8 application that uses spring-data-rest (@RepositoryRestResource) to Spring Boot 4.0.0 (using Jackson 3).

I used to be able to create entities with a HTTP Post Request and assign the entity to its relationship with a simple post request. For example, I have an order with order-item entities and I want to add an order item to the entity order. The following call used to work when I was using Spring Boot 3.5.8 ... but it does not with SB 4.0.0

POST http://localhost:8080/myapp/order-item
Content-Type: application/json

{
  "name": "item name",
  "order": "/order/1"
}

This does not work anymore. All my similar post endpoints are currently broken. The only thing that works for now is to change my payload to:

POST http://localhost:8080/myapp/order-item
Content-Type: application/json

{
  "name": "item name",
  "order":  {
    "id": 1
  }
}

Regards

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions