Create a gist now

Instantly share code, notes, and snippets.

Custom validator annotation
package sample;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import javax.validation.Constraint;
import javax.validation.Payload;
@Constraint(validatedBy = { SampleValidator.class })
public @interface SampleValidation {
String param() default "";
String message() default "Validation Error";
Class<?>[] groups() default {};
Class<? extends Payload>[] payload() default {};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment