0

I am using JSR 303 for validating my request object of rest controller. Validation is working fine but i am not getting the response. below is the code am i missing something ?

Pojo class:

    @ValInfo(message ="empty filed", groups=ExtendedValidation.class)
public class Request   {

Validator classes:

@Target({ ElementType.TYPE, ElementType.ANNOTATION_TYPE })
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = { ValInfoValidator.class })
@Documented
public @interface ValInfo {

 String message() default "{Client information invalid}";

 Class<?>[] groups() default {};

 Class<? extends Payload>[] payload() default {};
}


public class ValInfoValidator implements ConstraintValidator<ValInfo, TvxOnlineRequest> {

 @Override
 public void initialize(ValInfo arg0) {
  // TODO Auto-generated method stub

 }

 @Override
 public boolean isValid(TvxOnlineRequest arg0, ConstraintValidatorContext arg1) {
  // TODO Auto-generated method stub

  return false;
 }
user3927150
  • 61
  • 1
  • 2
  • 9
  • Please update the code of Request class also – Mohit Oct 26 '17 at 04:54
  • Also do read this post, might prove helpful - https://stackoverflow.com/questions/21963784/jsr-303-bean-validation-with-spring-does-not-kick-in – Mohit Oct 26 '17 at 04:55

0 Answers0