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

javaspringspring-mvc

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

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

Best Solution

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

@Pattern(regexp="^(0|[1-9][0-9]*)$")

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