From the course: Java EE: RESTful Service with JAX-RS 2.0

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Bean Validation introduction

Bean Validation introduction

From the course: Java EE: RESTful Service with JAX-RS 2.0

Start my 1-month free trial

Bean Validation introduction

- [Voiceover] We're going to have a look at how to use the Bean Validation API with jax-rs, how to state the constraints that the field must adhere to in order to pass validation, and how the API can be expanded with custom Bean Validators. Bean Validation cuts across application layers and touches every aspect of an application where data integrity needs to be maintained. Even though it is a relatively small API, it is very effective at cutting down the kind of repetitive code that you have to write to do the job of maintaining data integrity. Validation is triggered by the internal mechanism of the provider relevant for the API that you're using, and this happens transparently. Same for jax-rs, is a jax-rs provider that triggers the Bean Validation. The provider is provoked by annotating either a resource method or a method parameter with a valid annotation, or by using a validation constraint annotation directly on a method parameter. The fields of the entity to be validated should…

Contents