I have been researching stackoverflow over the following error:
org.springframework.http.converter.HttpMessageNotWritableException:
Could not write JSON: Unable to perform requested lazy initialization
The solution I need, is to have a way for jackson to ignore lazyloaded objects.
I found the following topics:
Could not write JSON: failed to lazily initialize a collection of role
Avoid Jackson serialization on non fetched lazy objects
The solutions specifies that I should either:
A) Extend WebMvcConfigurerAdapter and write a piece of code like in:
/a/34293357/2280645
B) Create a bean with module : Hibernate5Module() like in:
/a/37840526/2280645
However, both of these solutions wont work on Spring Boot 3.x, causing the same error.
Question:
How do I avoid jackson serialization on non fetched lazy objects when using the most recent 3.x Spring Boot version?
1