Skip to content
Advertisement

Fixed length Validation using Javax api

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.

Advertisement

Answer

If you want to change the default @Size message just declare parameter message into:

@Size(min = 3, max = 3, message = "Your constraint message")
private int anyNumber;
User contributions licensed under: CC BY-SA
7 People found this is helpful
Advertisement