java - Spring @Value adding Validation less than -
i using following property value injection. how can add less validation operation. mean want set validation user.maxpassiveday
property value has not less 100 lets say.
@value("${user.maxpassiveday}") int maxpassiveday;
using spring 3.1.1 version
you can use @value on setter method:
int maxpassiveday; @value("${user.maxpassiveday}") public void setmaxpassiveday(final string maxpassiveday) { int tmp = integer.parseint(maxpassiveday); if (tmp < 100) { this.maxpassiveday = tmp; } }
Comments
Post a Comment