Skip to content

Can't perform PATCH update of an entity referring a child related element with its Hal URL in Native context #33468

@mathieupedreropro

Description

@mathieupedreropro

Hi Spring boot team.

I think I found a bug, working with Spring Boot 3.0.0 and spring hateoas in a Sprong boot native context.

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

And in the meantime, when run my project in a non native context (for example in my favourite 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).

Thanks a lot !

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fixstatus: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions