-
Notifications
You must be signed in to change notification settings - Fork 563
Description
Hi,
First of all, I apologize for having allready submitted this issue in the spring boot project (My initial guess) and into the Hateaos project (following mhalbritter advice). Bu today, I tried to debug this issue by myself, and I realized some Spring-data-rest classes are at stake (ResourceSupportHttpMessageConverter, RepositoryRestMvcConfiguration, or PersistentEntityResource for example). So I think here should finally be the right place...
I'm working with Spring-boot 3.0.0, that (through spring dependecy-management) pulls spring-data-rest 4.0.0 in my project. I work in a native context (builder paketobuildpacks/builder:tiny, 'BP_NATIVE_IMAGE': 'true' in my gradle bootBuildImage task)
In a very simple context, when compiling with spring boot native, I can't perform a patch 'for example) update of my entity reffering a child entity with its url identifier.
When I perform a PATH request with a body like this one:
{
"shouldBeChecked": true,
"name": "Amical6",
"parent": null,
"authority": "https://myurl/api/authorities/e52cdfb6-6f3c-4552-8ea4-e1357b5d052c"
}
I get the following errors :
in the web navigator (running the client app):
{"cause":{"cause":null,"message":"Cannot construct instance of `org.[xxx].Authority` (although at least one Creator exists): no String-argument constructor/factory method to deserialize from String value ('https://myurl/api/authorities/e52cdfb6-6f3c-4552-8ea4-e1357b5d052c')\n at [Source: UNKNOWN; byte offset: #UNKNOWN] (through reference chain: org.[xxx].MyObject[\"authority\"])"},"message":"Could not read payload"}
And, in my application logs :
Failed to evaluate Jackson deserialization for type [[simple type, class org.springframework.data.rest.webmvc.PersistentEntityResource]]: java.lang.NullPointerException
While, in the meantime, when run my project in a non native context (for example in my IDE), I've got no problem at all.
Please find below:
- the Stack overflow discussion (https://stackoverflow.com/questions/74573299/how-to-deserialize-json-object-referring-related-data-using-hal-links-with-jacks?noredirect=1)
- A reproducer project (how-to reproduce is described in the readme) (https://github.com/mathieupedreropro/spring-hal-jackson-graalvm).
- the inital issue I submitted to spring boot project (Can't perform PATCH update of an entity referring a child related element with its Hal URL in Native context spring-boot#33468)
- the issue I submitted to spring hateoas project (Can't perform PATCH update of an entity referring a child related element with its Hal URL in Native context spring-hateoas#1883)
Thanks a lot !