Skip to content

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

@mathieupedreropro

Description

@mathieupedreropro

Hi Spring Hateoas team !

I think I found a bug (I initially created an issue on spring-boot project, by I was told by mhalbritter this is most likely to be an issue for hateoas.

I'm working with Spring-boot 3.0.0, that (through spring dependecy-management) pulls spring-hateoas 2.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 favourite IDE), I've got no problem at all.

Please find below:

Thanks a lot !

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions