I am using Jackson as JSON provider with Apache CXF. I would like to use Jackson mix-ins to shape the structure of JSON returned by the REST controllers. The mix-ins would apply to domain objects (unannotated) to ignore some properties during serialization.
All the examples of mix-ins deal with their programmatic application, where you create an ObjectMapper object and apply mix-ins to it at runtime. In my REST layer, I am not using Jackson programmatically. It is registered as JSON provider for CXF (through blueprint XML – this is OSGI environment).
My question is how to apply mix-ins to Jackson without having to explicitly create ObjectMapper and call writeValue() on it. Also, how to apply mix-ins dynamically to allow a REST controller to return different representation of the same domain object based on request parameters?
Thank you,
Michael
Check the Javadoc on JacksonJsonProvider: