spring-projects / spring-data-rest

Simplifies building hypermedia-driven REST web services on top of Spring Data repositories
https://spring.io/projects/spring-data-rest
Apache License 2.0
913 stars 561 forks source link

Argument resolver for `PersistentEntityResource` invalidly asks converter whether they can deserialize `PER` #2419

Closed odrotbohm closed 1 day ago

odrotbohm commented 1 day ago

In PersistentEntityResourceHandlerMethodArgumentResolver, we ask the downstream HttpMessageConverters whether they can read PersistentEntityResource. For Jackson-based converters, this will result in a call to ObjectMapper.canDeserialize(…) which apparently accidentally works on Jackson 2.17. On 2.18 the detection of the creator properties seems to have changed so that PER is (rightfully) rejected for deserialization. This now causes no converter being found and thus an HttpMessageNotReadableException being thrown.

We should switch to asking the converters whether they're able to read the actual domain type, as that's what we actually do in the subsequent call to read(…).