What does the @Valid annotation indicate in Spring?

前端 未结 8 1532
隐瞒了意图╮
隐瞒了意图╮ 2020-12-04 20:38

In the following example, the ScriptFile parameter is marked with an @Valid annotation.

What does @Valid annotation do?

<
8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-04 21:27

    IIRC @Valid isn't a Spring annotation but a JSR-303 annotation (which is the Bean Validation standard). What it does is it basically checks if the data that you send to the method is valid or not (it will validate the scriptFile for you).

提交回复
热议问题