Reputation: 439
In my spring application in WebMvcConfigurerAdapter, CustomObjectMapper is added in HttpMessageConverter. The CustomObjectMapper has setSerializationInclusion(Include.NON_NULL). For 1 particular pojo returned via Spring's ResponseBody I want null properties to be returned as well. I cannot change global setting as it will impact all controllers endpoints. Any suggestions ?
Upvotes: 0
Views: 352
Reputation: 2560
You can create a mixin for the Pojo of interest and set the mixin on your CustomObjectMapper. This other answer shows exactly how to do this.
Upvotes: 1