HOME

TheInfoList



OR:

Bean Validation defines a metadata model and API for JavaBean validation. The metadata source is
annotations An annotation is extra information associated with a particular point in a document or other piece of information. It can be a note that includes a comment or explanation. Annotations are sometimes presented in the margin of book pages. For anno ...
, with the ability to override and extend the meta-data through the use of
XML Extensible Markup Language (XML) is a markup language and file format for storing, transmitting, and reconstructing arbitrary data. It defines a set of rules for encoding documents in a format that is both human-readable and machine-readable ...
validation descriptors. Originally defined as part of
Java EE Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web ser ...
, version 2 aims to work in
Java SE Java Platform, Standard Edition (Java SE) is a computing platform for development and deployment of portable code for desktop and server environments. Java SE was formerly known as Java 2 Platform, Standard Edition (J2SE). The platform uses Ja ...
apps as well. Java Bean Validation
JSR 303
originated as a
framework A framework is a generic term commonly referring to an essential supporting structure which other things are built on top of. Framework may refer to: Computing * Application framework, used to implement the structure of an application for an op ...
that was approved by the JCP as of 16 November 2009 and accepted as part of the
Java EE Jakarta EE, formerly Java Platform, Enterprise Edition (Java EE) and Java 2 Platform, Enterprise Edition (J2EE), is a set of specifications, extending Java SE with specifications for enterprise features such as distributed computing and web ser ...
6 specification. The
Hibernate Hibernation is a state of minimal activity and metabolic depression undergone by some animal species. Hibernation is a seasonal heterothermy characterized by low body-temperature, slow breathing and heart-rate, and low metabolic rate. It most ...
team provides with Hibernate Validator the
reference implementation In the software development process, a reference implementation (or, less frequently, sample implementation or model implementation) is a program that implements all requirements from a corresponding specification. The reference implementation o ...
of Bean Validation and also created the Bean Validation TCK any implementation of JSR 303 needs to pass.


Current Version

Bean Validation 2.0 is defined b
JSR 380
approved 2017-07-31. This major release leverages language features in Java 8 that are very useful for the purposes of Bean Validation. So Java 8 is required as the minimum Java version. Other changes include: *Support for validating container elements by annotating type arguments of parameterized types, e.g. List<@Positive Integer> positiveNumbers; this also includes: **More flexible cascaded validation of collection types; e.g. values and keys of maps can be validated now: Map<@Valid CustomerType, @Valid Customer> customersByType **Support for java.util.Optional **Support for the property types declared by
JavaFX JavaFX is a software platform for creating and delivering desktop applications, as well as rich web applications that can run across a wide variety of devices. JavaFX has support for desktop computers and web browsers on Microsoft Windows, Linu ...
**Support for custom container types by plugging in additional value extractors *Support for the new date/time data types for @Past and @Future; fine-grained control over the current time and time zone used for validation *New built-in constraints: @Email, @NotEmpty, @NotBlank, @Positive, @PositiveOrZero, @Negative, @NegativeOrZero, @PastOrPresent and @FutureOrPresent *All built-in constraints are marked as repeatable now *Parameter names are retrieved using reflection *ConstraintValidator#initialize() is a default method *The namespace for Bean Validation XML descriptors has been changed to http://xmlns.jcp.org/xml/ns/validation/configuration for META- INF/validation.xml and http://xmlns.jcp.org/xml/ns/validation/mapping for constraint mapping files


Previous Version

Bean Validation 1.1
JSR 349
improves upon the initial version 1.0
JSR 303
. Significant changes include: *Validation of method arguments and return value *Dependency Injection *More open process in developing the specification Final release o
the 1.1 specification
occurred 2013-05-24.


References


Further reading

* Open development work of JSR 303, 349, & 380
Video of presentation at Devoxx, *Bean Validation 2.0 - you’ve put your annotations everywhere! by Gunnar Morling*Interview with Spec Lead Emmanuel BernardJSR 303 PageBean Validation TCK documentationHow to run the Bean Validation TCK
{{Jakarta EE Java specification requests