Where @Validated annotations cannot take effect

1. Place of use

  • post
  • put
  • Insert picture description here

2. Unusable places

Insert picture description here

  • Here @NotNull is effective when stockHolderArray is null, but the internal verification of StockHolderInfo is not effective.
  • The validation annotation @Valid needs to be added to the array of objects here
    Insert picture description here
    , then the validation-related annotations inside StockHolderInfo will take effect.

Guess you like

Origin blog.csdn.net/wangleisuiqiansuiyue/article/details/110053303