Avoid Jackson serialization on non fetched lazy objects

前端 未结 14 2015
终归单人心
终归单人心 2020-11-22 13:02

I have a simple controller that return a User object, this user have a attribute coordinates that have the hibernate property FetchType.LAZY.

When I try to get this

14条回答
  •  眼角桃花
    2020-11-22 13:32

    You can use the following helper from Spring Data Rest project:

    Jackson2DatatypeHelper.configureObjectMapper(objectMapper);
    

提交回复
热议问题