Jersey Jackson data entity filtering JsonMappingException on collection

前端 未结 2 932
一个人的身影
一个人的身影 2021-02-09 06:50

I have an issue when trying to put in place the “selectable entity filtering”. I have an Abstract class like following one:

   // In your Pom
    

        
2条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-02-09 07:33

    It seems that when you are using the SelectableEntityFilteringFeature and if you are putting Collection as an Entity in Response then you will get a JsonMappingException. For me it is a bug. The work around is you should encapsulate your collection into GenericEntity to be able to be serialized by Jersey-Jackson.

    return Response.status(Status.OK)
           .entity(new GenericEntity>(entityIDs)     {}).build(); 
    // Use GenericEntity to avoid JsonMappingException  because of the new flow with Filtering
    

提交回复
热议问题