Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

参数校验部分说明错误 #2467

Open
mjhxy opened this issue Aug 29, 2024 · 1 comment
Open

参数校验部分说明错误 #2467

mjhxy opened this issue Aug 29, 2024 · 1 comment
Labels
bug Content error

Comments

@mjhxy
Copy link

mjhxy commented Aug 29, 2024

原文:“JSR(Java Specification Requests) 是一套 JavaBean 参数校验的标准,它定义了很多常用的校验注解,我们可以直接将这些注解加在我们 JavaBean 的属性上面,这样就可以在需要校验的时候进行校验了,非常方便!”,出处是“Spring&SpringBoot常用注解总结”

错误:JSR并不是JavaBean参数校验的标准,建议改成“JSR 380(Bean Validation 2.0) 是一套用于 JavaBean 参数校验的标准”或类似的描述。

@Snailclimb
Copy link
Owner

JSR并不是JavaBean参数校验的标准

感谢指出,这样修改会不会更清晰一些:

Bean Validation 是一套定义 JavaBean 参数校验标准的规范 (JSR 303, 349, 380),它提供了一系列注解,可以直接用于 JavaBean 的属性上,从而实现便捷的参数校验。

  • JSR 303 (Bean Validation 1.0): 奠定了基础,引入了核心校验注解(如 @NotNull@Size@Min@Max 等),定义了如何通过注解的方式对 JavaBean 的属性进行校验,并支持嵌套对象校验和自定义校验器。
  • JSR 349 (Bean Validation 1.1): 在 1.0 基础上进行扩展,例如引入了对方法参数和返回值校验的支持、增强了对分组校验(Group Validation)的处理。
  • JSR 380 (Bean Validation 2.0): 拥抱 Java 8 的新特性,并进行了一些改进,例如支持 java.time 包中的日期和时间类型、引入了一些新的校验注解(如 @NotEmpty, @NotBlank等)。

@Snailclimb Snailclimb reopened this Aug 29, 2024
@Snailclimb Snailclimb added the bug Content error label Aug 29, 2024
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Content error
Projects
None yet
Development

No branches or pull requests

2 participants