About Bean Validation
The JSR 303-bean Validation is a sub-specification in Jree6, and theJSR 303-bean Validation focuses on the following practical issues:
At any time, when you are dealing with the business logic of an application, data validation is something you have to consider and face. The application must have some means to ensure that the input data is semantically correct. In the usual case, the application is layered and different layers are done by different developers. Many times the same data validation logic appears on different layers, which leads to code redundancy and some management issues, such as semantic consistency. To avoid this situation, it is best to bind the validation logic to the appropriate domain model.
Bean Validation defines the corresponding metadata model and API for JavaBean validation. The default metadata is Java Annotations, which allows you to overwrite and extend the original metadata information by using XML. In the application, you @NotNull
@Max
@ZipCode
can ensure the correctness of the data Model (JavaBean) by using Bean Validation or your own defined constraint, for example. Constraint can be attached to fields, getter methods, classes, or interfaces above. For some specific needs, users can easily develop customized constraint. Bean Validation is a runtime data validation framework that verifies that the error message is returned immediately after validation.
What is a JSR 303-bean Validation?