Google Groups

Re: Access to ObjectMapper

Sean Sullivan May 16, 2012 6:01 AM
Posted in group: dropwizard-user
As far as I can tell, the only way to tweak the ObjectMapper is to:

1) subclass Json
2) override the Service#getJson method

Here's a small example of this approach:

I haven't found a better solution.


On Mon, May 7, 2012 at 12:53 PM, Christopher Currie
<> wrote:
> I want to use the Jackson Streaming API for some internal processing. Looking at the DW classes, I seem to note that the Json object doesn't expose the underlying ObjectMapper instance, but instead makes it protected, requiring subclassing to get at the Streaming API. Subclassing then appears to require the service implement getJson(), duplicating some of the default logic, in order for the instance to be used by the JacksonMessageBodyProvider.
> It feels a little hacky to do that just to get at the ObjectMapper instance. Is another way, short of creating a new ObjectMapper instance, to get it?