--Under development of app with spring-boot
--You made a mistake in the annotation you should use.
Validation was set in a way that cannot be used with @Pattern
.
There was an unexpected error (type=Internal Server Error, status=500).
HV000030: No validator could be found for constraint 'javax.validation.constraints.Pattern' validating type 'java.math.BigDecimal'. Check configuration for 'price'
Translation:
HV000030:Mold'java.math.BigDecimal'Constraints to verify
'javax.validation.constraints.Pattern'The validator was not found. price'Check the configuration of.
Wrong
//Required input, 1000 yen or more, convert to numerical value
@NotNull
@Min(1000)
@Pattern(regexp = "#,###") //Convert the character string of the specified pattern to a numerical value
private BigDecimal price;
Positive
//Required input, 1000 yen or more, convert to numerical value
@NotNull
@Min(1000)
@NumberFormat(pattern = "#,###") //Convert the character string of the specified pattern to a numerical value
private BigDecimal price;
Recommended Posts