Bean Validation

What is Bean Validation

Bean Validation is a Java specification which

  • lets you express constraints on object models via annotations
  • lets you write custom constraints in an extensible way
  • provides the APIs to validate objects and object graphs
  • provides the APIs to validate parameters and return values of methods and constructors
  • reports the set of violations (localized)
  • runs in Java SE but is integrated in Java EE (6 and 7)
public class User {
    @NotNull @Email 
    public String getEmail() { return email; }
    public void setEmail(String email) { = email; 
    private String email;

public class UserService {
  public void createUser(@Email String email,
                         @NotNull String name) {

While you can run validation manually, it is more natural to let other specifications and frameworks validate data at the right time (user input in presentation frameworks, business service execution by CDI, entity insert or update by JPA).

In other words, run once, constrain anywhere.

Learn more and get the specification...

Feed Latest news

Stay up to date, subscribe to the news feed.

Bean Validation TCK 1.1.4.Final released

18 June 2015

Exactly one year after the last maintenance release we've published version 1.1.4.Final of the Bean Validation TCK today. It contains exactly one issue, BVTCK-68, which is about the removal of two tests from the TCK which could not be tested in a portable manner across containers. Check out the issue itself for the...

Bean Validation TCKs now with signature files for Java SE 8

18 June 2014

Good news for those of you who want to certify the compatibility of a Bean Validation implementation (and its API JAR) against Java SE 8. We have released updates to the Bean Validation TCK 1.0 and 1.1; The versions are 1.0.7.GA and 1.1.3.Final, respectively. Both TCK releases come now with a version of the...

Training materials on Bean Validation 1.1

28 May 2014

I have two good Bean Validation related content for you today. Training slides (in French) Laurent Guerin wrote a comprehensive training on Bean Validation (1.0 and 1.1) for French students. The slides are available under a Creative Commons license. I did review them and they are very good. The bad news is that they are...