java - Setting dynamic data to min and max attributes of @Range annotation - hibernate validators -
iam using hibernate validator validation of data. have used @range attribute validating particular field. @range(min=0,max=100) private string amount; this fine can dynamically change values of min , max instead of hard coding. mean can like: @range(min=${},max=${}) private string amount; annotations in java uses constants parameters. cannot change them dynamically. compile constants can primitives , strings.check link . if want make configurable can declare them static final. for example: private static final int min_range = 1; private static final int max_range = 100; and assign in annotation. @range(min=min_range,max=max_range) private string amount; the value annotation attribute must constant expression.