title: Custom bean validation
body: <p>I'm developing an application using spring-boot. I want to validate the user bean using JSR annotation. The problem is that I have some fields that depend on the value of others. For example when status="user_pr" I have to make the address, county, and phoneNumber as mandatory. </p>
  
  <p>this my bean: </p>
  
  <pre><code> @JsonIgnoreProperties(ignoreUnknown = true)
  @JsonInclude(JsonInclude.Include.NON_NULL)
  public class User {
  
      @NotNull(message = "required")
      private String status;
  
      @JsonProperty("first_name")
      @NotNull(message = "required")
      private String firstName;
  
      @NotNull(message = "required")
      private String name;
  
      @NotNull(message = "required")
      @Pattern(message = "Email not valid", regexp = "^([\\w\\.\\-_]+)?\\w+@[\\w-_]+(\\.\\w+){1,}$")
      private String mailAddress;
  
      private String country;
      private String phoneNumber;
  
      @JsonProperty("address")
      private Address billingAddress;
  }
  </code></pre>
  
  <p>Would you have any ideas ?</p>
  
  <p>Best regards </p>