I'm currently struggling to implement a restfull api using -> Spring Boot 3.0.0, using spring data rest and spring hateoas -> Spring native support
Basically, I would like to patch an entity, submitting a new value for a field (pointing to an existing entity in Database).
The reference is handled with an hal link. below is the Json object I "PATCH" to my EntityRepository controller:
{
"shouldBeChecked": true,
"name": "Amical6",
"parent": null,
"authority": "https://myurl/api/authorities/e52cdfb6-6f3c-4552-8ea4-e1357b5d052c"
}
Everything is fine when I run the app from my IDE (without GraalVM Native compilation). But when I go live on my test environment (copiled with GraalVM), 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
I'm pretty sure I've got to add some Native Hints related to Jackson (or maybe Spring hateoas ?). Could someone help me with this?
Regards,
EDIT 2022.11.30 Please find below a small reproducer project: https://github.com/mathieupedreropro/spring-hal-jackson-graalvm
TLDR
I tried to use Spring Hateoas link handling to patch data to my Rest Webservice in a Native compiled Spring boot 3.0.0 application.
It fails at runtime, when the same application works like a charm using a traditional JDK