I'm working with spring boot, one of the inputs of my object, has to accept only a set of integers, and I'm not getting it.
This is my last approach:
@Pattern(regexp="\\d{1111}|\\d{2222}|\\d{3333}|\\d{4444}", message="The value has to be '1111','2222','3333' or '4444'")
private int code;
This is not valid because I'm getting this error:
"statusText": "HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validating type 'java.lang.Integer'. Check configuration for 'code'",
How can I manage this?