Validating double and float values using Hibernate Validator - bean validation

前端 未结 6 1454
心在旅途
心在旅途 2020-12-29 11:16

I\'m looking for a way to validate a java.lang.Double field in the Spring command bean for its maximum and minimum values (a value must lie between a given rang

6条回答
  •  佛祖请我去吃肉
    2020-12-29 11:36

    You can use the annotation, but you might get false results depending. This is a general problem with doubles and imo in many cases _Double_s should be avoided. Maybe switching to a different type is the best solution? BigDecimal for example?

提交回复
热议问题