I was writing pact provider test which validate the incoming request from consumer and i have used custom constraint validator for that like
public class MaxRecipients implements
ConstraintValidator<MaxRecipientsSize, Collection> {
@Value("${recipient.max.size}")
private Integer recipientMaxSize;
@Override
public void initialize(MaxRecipientsSize constraintAnnotation) {
}
@Override
public boolean isValid(Collection value, ConstraintValidatorContext cvc) {
if (isEmpty(value)) {
return TRUE;
}
Here when control comes, the value of recipientMaxSize becomes null, i have configured the property in application properties and property source. Can someone help on this?