Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make @JsonSnakeCase the default for configuration in Dropwizard

How will I configure jackson to use snake case in dropwizard instead of putting @JsonSnakeCase in every class ?

like image 214
Manikandan Avatar asked Dec 12 '13 15:12

Manikandan


2 Answers

And finally am able to find the answer.. Just add below cofiguration.

environment.getObjectMapperFactory().setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES)
like image 156
Manikandan Avatar answered Nov 20 '22 04:11

Manikandan


Just add this following line in your run() method

environment.getObjectMapper().setPropertyNamingStrategy(
        PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
like image 40
hatellla Avatar answered Nov 20 '22 05:11

hatellla