Binder Validators

I am currently using the latest version of Vaadin: 24.3.5.

Does bean binding validators work? I am unable to get it to work successfully. Although Vaadin validators do work.

This current works:

private Binder<Task> binder = new Binder<>(Task.class);
                .withValidator(new EmailValidator("Invalid email address"))
                .bind(Task::getEmail, Task::setEmail); ```

This will **NOT** work:

@Email(message = “Invalid email format”)
private String email;

private Binder binder = new BeanValidationBinder<>(Task.class);

binder.bind(emailField, Task::getEmail, Task::setEmail);

Please keep in mind I am new to Vaadin so may be misunderstanding how this works.

To use JSR 303 Bean Validation annotations with BeanValidationBinder you have to bind by property name


Thank you that appears to have worked. I guess my understand was not on point.