I want to validate different properties of object based on the occasion. For an example lets say I have a User object
public class User{
private String username;
private String password;
private String age;
}
When adding a user I want to validate all fields. But when user reset a password there would be username and password. If Spring validator tries to validate age as well it'll be a failure.
Is there a way that I can tell Spring validator to only validate a certain subset of object properties.