Reputation: 5142
The following way,
environment.getObjectMapper().setPropertyNamingStrategy(PropertyNamingStrategy.CAMEL_CASE_TO_LOWER_CASE_WITH_UNDERSCORES);
we can set PropertyNamingStrategy for all resources apis in Dropwizard project. We have used this in our project.
What I wanted to do is that in case of 1 resource file, I do not wanted to use any PropertyNamingStrategy. In all other resource, I wanted to use it. Is it possible to do in Dropwizard?
Upvotes: 0
Views: 103
Reputation: 2858
You cannot do it on resource level AFAIK but you can do it on DTO class level. I'm assuming you're using an existing DTO class for that particular resource. As a solution you can extend that class.
@JsonNaming(value = PropertyNamingStrategy.LowerCaseWithUnderscoresStrategy.class)
public class MyDtoWithUnderscore extends MyDto {
public MyDtoWithUnderscore(){}
}
Upvotes: 2