Java – how check string is integer or not by using spring annotations


**i want test user input is a alpha-numeric or integer by using spring form annotations **

i have also tried this code.
        @NumberFormat(style = Style.NUMBER)
        @Length(min =11,max =11)
        private String xyz;

Best Solution

I ran into a similar problem and used the @Pattern annotation to compare against a regular expression.


The annotation is part of the javax.validation.constraints package.