"I found that there is no annotation for validating static methods. Sometimes, certain validations need to be globally managed in a static method of a class, which will validate properties of other entity classes. Currently, most of the validation annotations are scattered."
like this:
@Valid(method="xxx.xxx.checkName",message="name valid fail")
private String username;
Comment From: philwebb
Spring Boot does not provide any validators, instead it just provides a dependency to Jakarta Bean Validation and allows you to use @jakarta.validation.Constraint annotations. You can almost do what you want by referencing a jakarta.validation.ConstraintValidator<?, ?> inner class.
If you want method validation support, you'll need to raise your request with the Jakarta Bean Validation team.
Comment From: lilingshan
Thank you, You answer solved my problem