Bean Validation works as a normal validator. If you have a bean with Bean Validation annotations, such as:

    Java

    Java

    and add the bean validation as a normal validator:

    Your field is now automatically validated based on the annotations in your bean class. You can do the same thing for the age field and you won’t be able to set a value outside the valid 0-100 range.

    A Bean Validation tutorial is available here: