request response can be validated using javax annotation. However, need some help to have fixed length validation, as @Size(min=3, max=3). It is having message that ‘size must be between 3 and 3’. This is required to be changed.
If you want to change the default @Size message just declare parameter
@Size(min = 3, max = 3, message = "Your constraint message") private int anyNumber;