0

I want to use some validation for this POJO:

@Data
public class Simulation {

  ...

  @DecimalMin(value = "${minimum-value}")
  private BigDecimal value;
  
  ...

}

Using this YAML configuration:

minimum-value: 500

It seems I'm missing something, because I get the following error whenever an instance of Simulation is created:

Caused by: java.lang.IllegalArgumentException: HV000016: ${minimum-value} does not represent a valid BigDecimal format.
thmasker
  • 406
  • 1
  • 9
  • 21
  • 1
    I think your question is answered here: [Spring Bean Validation with configurable constraint values](https://stackoverflow.com/questions/56920934/spring-bean-validation-with-configurable-constraint-values) – Ali Can Feb 18 '21 at 10:30
  • Interesting. But I have to create my own `DecimalMin` version then, right? – thmasker Feb 18 '21 at 14:37
  • 1
    Yes, exactly. You should define your own annotation with the required parameter(s). See how `@MaxGramsOfCheese` is implemented in the answers. – Ali Can Feb 18 '21 at 14:44

0 Answers0