JAX-RS separates quite nicely the deserialization from the validation, i.e. JSON-B (or Jackson) has by design no mechanism to enforce values to be non-null, etc. Instead, you can use BeanValidation for that:
- Add a dependency to
javax.validation:validation-apiinprovidedscope. - Add the
javax.validation.constraints.NotNullannotation to your field.
For more details, go here.