I am using Jersey / JAX-RS through DropWizard 0.7.1 to open RESTful service endpoints. I have all my POJO entities annotated with both JAX-RS validation annotations and Hibernate / JSR-303 bean, for example:
public class Widget { @JsonProperty("fizz") @NotNull @NotEmpty private String fizz;
When a resource method receives one of these POJOs as input (under the hood, DropWizard already deserializes the HTTP JSON object into a Widget
instance), I would like to test it against Hibernate / Bean validation annotations
@POST Response saveWidget(@PathParam("widget") Widget widget) { // Does DropWizard or Jersey have something built-in to automagically validate the // 'widget' instance? }
Can I configure DropWizard / Jersey to validate my Widget
instance, without having to write validation code here?
source share