当前位置: 首页 > 工具软件 > eg-validation > 使用案例 >

JSR 380: Bean Validation 2.0

松昱
2023-12-01

Java Community Process
Submit this Search
Press Room | Get Java Here |
Find JSRs
Submit this Search

JSRs by Platform
JSRs by Technology
JSRs by Stage
JSRs by Committee
List of All JSRs
My JCP

Register for Site
Use of JCP site is subject to the JCP Terms of Use and the Oracle Privacy Policy
JCP Info
About JCP
    Program Overview
    JCP Process Document
    Calendar
    JCP Members
    Executive Committee
    Elections
Get Involved
    Overview
    Becoming a JCP Member
Community Resources
    Overview
    Tutorials
    JCP Podcasts
    Spec Lead Guide
    TCK Tool & Info
    License Reference
Community News
    News
    Programs & Awards
    Press Releases
    Success Stories
FAQ
Contact Us

Ad Banner

JSR
Community
Expert Group

Summary | Proposal | Detail (Summary & Proposal) | Nominations
JSRs: Java Specification Requests
JSR 380: Bean Validation 2.0

Stage Access Start Finish
Final Release Download page 21 Aug, 2017
Final Approval Ballot View results 18 Jul, 2017 31 Jul, 2017
Proposed Final Draft Download page 23 Jun, 2017
Public Review Ballot View results 30 May, 2017 12 Jun, 2017
Public Review Download page 27 Apr, 2017 27 May, 2017
Early Draft Review Download page 13 Feb, 2017 15 Mar, 2017
JSR Review Ballot View results 26 Jul, 2016 08 Aug, 2016
JSR Review 13 Jul, 2016 25 Jul, 2016
Status: Final
JCP version in use: 2.10
Java Specification Participation Agreement version in use: 2.0

Description:
This JSR aims at evolving the Bean Validation specification by leveraging Java 8 language constructs for the purposes of validation.

Expert Group Transparency:
Public Project Page
Public Communications
Issue Tracking

Team

Specification Leads
Gunnar Morling Red Hat
Expert Group
Canoo AG
: Hendrik Ebbers Fujitsu Limited
: Tsuyoshi Yoshitomi Genidea Sagl
: Marco Molteni
ingenit GmbH & Co. KG
: Christian Kaltepoth Werner Keil Oracle
: Linda Demichiel
Red Hat
: Emmanuel Bernard Red Hat
: Gunnar Morling Otavio Santana
Michael Nascimento Santos
Contributors
Matt Benson

Original Java Specification Request (JSR)

Identification | Request | Contributions | Additional Information

Section 1. Identification

Submitting Member: Red Hat

Name of Contact Person: Gunnar Morling

E-Mail Address: gmorling@redhat.com

Telephone Number: +49 69 365051 000

Fax Number: +49 69 365051 001

Specification Lead Member: Red Hat

Specification Leads: Gunnar Morling

E-Mail Address: gmorling@redhat.com

Telephone Number: +49 69 365051 000

Fax Number: +49 69 365051 001

Initial Expert Group Membership:

  • Red Hat
  • Oracle
  • Fujitsu
  • Tomitribe
  • Adam Bien
  • Michael Nascimento

Supporting this JSR:

  • Red Hat
  • London Java Community
  • Oracle
  • Fujitsu
  • Tomitribe
  • V2COM
  • HPE
  • Werner Keil
  • Matt Benson

Section 2: Request

2.1 Please describe the proposed Specification:

Bean Validation standardizes constraint definition, declaration and validation for the Java platform. Its first two incarnations have been widely popular amongst the Java community in both, SE and EE environments. Integrations with many other specifications (CDI, JAX-RS, JPA, etc.) and frameworks have been created.

Since Bean Validation 1.1 (which addressed many feature requests created by the community), Java 8 has been released, adding several language improvements which are very useful for the purposes of Bean Validation. Therefore the work of the Expert Group will be primarily focused on embracing Java 8 features:

  • Use type-use annotations to apply constraints to collection elements: List<@NotNull @Email String> emails;
  • Mark the standardized constraints with @Repeatable eliminating the need for the explicit usage of the @Size.List pattern
  • Support @Future/@Past for the types of the new time and date API (JSR 310)
  • Retrieve parameter names via reflection to report parameter constraint violations
  • Integrate with new Optional wrapper type

Note, that in order to leverage these constructs, Bean Validation 2.0 will require Java 8 as the minimum Java version.

In addition to the Java 8 related changes, Bean Validation 2.0 will seek to address further feature requests and improvements raised by the community. Potential examples for such features are:

  • Simpler constraint ordering on single properties
  • Custom payload for constraint violations
  • Separate the notion of message interpolation and retrieval of message bundles
  • Clarification of ambiguities found in Bean Validation 1.1
  • Alignment with the JDK 9 modular environment
  • ConstraintViolationException builder
  • Validate an object graph assuming a list of changes to be applied

Note that this list is not exhaustive but gives a good representation. Additional feature requests are available in Bean Validation’s issue tracker https://hibernate.atlassian.net/projects/BVAL. The goal of the Expert Group will be to assess these issues, prioritize them as well as identify and pursue directions for enhancement of the overall programming model and facilities of Bean Validation.

Prototypes and implementations for some of these features have been carried out by the Hibernate Validator community (RI). This will help to shape a high quality standard thanks to the experience gained.
2.2 What is the target Java platform? (i.e., desktop, server, personal, embedded, card, etc.)

The target platforms are Java EE and Java SE.
2.3 The Executive Committees would like to ensure JSR submitters think about how their proposed technology relates to all of the Java platform editions. Please provide details here for which platform editions are being targeted by this JSR, and how this JSR has considered the relationship with the other platform editions.

The Bean Validation API is designed for both Java EE and Java SE platform environments.

It is proposed that Bean Validation 2.0 will be included as a required part of the Java Platform, Enterprise Edition version 8. Aligning the timeline of this JSR with that of Java EE 8 may therefore impact the scope of the Bean Validation 2.0 release. Features that may not be able to be addressed in Bean Validation 2.0 due to time constraints may become candidates for a future release.

On the other hand, Bean Validation 2.0 can finalized without waiting for Java EE 8. If needed, a maintenance release of the Bean Validation 2.0 specification can be done in order to address requirements related to the integration into the Java EE 8 platform as the development of the latter progresses.
2.4 What need of the Java community will be addressed by the proposed specification?

The goal of the proposed specification is to address the needs of the Java community regarding validation use cases such as the validation of collection elements by leveraging Java 8 features such as type annotations, repeatable annotations and more. In addition it is planned to add functionality to the Bean Validation API in order to address requests received from community members and other JSR expert groups. Possible examples include ordering of constraints and an API to facilitate the creation of constraint violations.
2.5 Why isn’t this need met by existing specifications?

Bean Validation 1.1 was specified prior the release of Java 8. Bean Validation 2.0 will be the first opportunity to leverage the new Java 8 constructs for the purposes of validation. Additionally, the Bean Validation 2.0 release will augment the Bean Validation API with features that have been requested by the community and that are not present in the current release.
2.6 Please give a short description of the underlying technology or technologies:

See above.
2.7 Is there a proposed package name for the API Specification? (i.e., javapi.something, org.something, etc.)

The Bean Validation 2.0 specification will continue to use the javax.validation package as the root package.
2.8 Does the proposed specification have any dependencies on specific operating systems, CPUs, or I/O devices that you know of?

No.
2.9 Are there any security issues that cannot be addressed by the current security model?

No.
2.10 Are there any internationalization or localization issues?

Internationalization and localization is a feature of Bean Validation and no issue is expected at this stage.
2.11 Are there any existing specifications that might be rendered obsolete, deprecated, or in need of revision as a result of this work?

No.
2.12 Please describe the anticipated schedule for the development of this specification.

  • Early Q3 2016 Expert Group formed
  • Late Q3 2016 Early Draft
  • Q4 2016 Public Review
  • Q1 2017 Final Release
    2.13 Please describe the anticipated working model for the Expert Group working on developing this specification.

This specification will be developed in the open according to the Open Source philosophy and the JCP 2.10 rules. The primary means of communication will be via a public mailing list, the specification website, its issue tracker, its GitHub account and conference calls if required. Face-to-face meetings will be scheduled if needed.
2.14 Provide detailed answers to the transparency checklist, making sure to include URLs as appropriate:

Q: Is the schedule for the JSR publicly available, current, and updated regularly?
A: Yes. It is shown this JSR’s page at jcp.org. Updates will be communicated on the blog http://beanvalidation.org/ if needed.

Q: Can the public read and/or write to a wiki for the JSR?
A: There will be public read/write access, but not via a wiki. Means of communication will be via:

  • Forum
  • Patch exchanges (GitHub pull requests)
  • discussions on the issue tracker
  • “Write” access will happen through the open issue tracker access as well as pull requests to the Bean Validation website

Q: Is there a publicly accessible discussion board for the JSR that you read and respond to regularly?
A: Yes. We will to continue to interact with the community via the Bean Validation forum already used during the development of JSR 303 and JSR 349 at https://forum.hibernate.org/viewforum.php?f=26

Q: Have you spoken at conferences and events about the JSR recently?
A: The general goal of Bean Validation 2.0 has been discussed at some conferences including Devoxx. It is expected that expert group members will participate in conferences such as JavaOne and events and present updates on Bean Validation 2.0.

Q: Are you using open-source processes for the development of the RI and/or the TCK?
A: Yes. The Bean Validation RI is developed in the open source project Hibernate Validator (http://hibernate.org/validator). Also the Bean Validation TCK is developed in the open. The source code is available at https://github.com/hibernate/hibernate-validator and https://github.com/beanvalidation/beanvalidation-tck, respectively.

Q: What are the Terms of Use required to use the collaboration tools you have prepared to use with the Expert Group, so that prospective EG members can judge whether they are compatible with the JSPA?
A: For using the publicly available issue tracker, the terms of use described at http://www.atlassian.com/hosted/terms.jsp apply. For using the source code management system (e.g. to propose changes to the spec, the RI, the TCK or the beanvalidation.org website), the terms of use described at https://github.com/site/terms apply.

Q: What is the location of your publicly-accessible Issue list? In order to enable EC members to judge whether Issues have been adequately addressed, the list must make a clear distinction between Issues that are still open, Issues that have been deferred, and those that are closed, and must indicate the reason for any change of state.
A: The issue tracker is located at https://hibernate.atlassian.net/projects/BVAL/. JIRA issue states will be used to indicate the current status of specific issues.

Q: What is the mechanism for the public to provide feedback on your JSR?
A: The public can use the following channels to provide feedback:

  • Use the forum linked above
  • Comment on specific issues in the BVAL issue tracker
  • Reply to or start new discussions on the beanvalidation-dev mailing list

Q: Where is the publicly-accessible document archive for your Expert Group?
A: The website at http://beanvalidation.org/ is the hub for archiving all documents and other contents around Bean Validation.

Q: Does the Community tab for my JSR have links to and information about all public communication mechanisms and sites for the development of my JSR?
A: This will be the case.

Q: Do you have a Twitter account or other social networking feed which people can follow for updates on your JSR?
A: An RSS feed containing all updates announed on beanvalidation.org is available at http://beanvalidation.org/news/news.atom

Q: Which specific areas of feedback should interested community members (such as the Adopt-a-JSR program) provide to improve the JSR (please also post this to your Community tab)?
A: We are especially interested in real-world experiences with Bean Validation 1.0/1.1 as well as the proprietary support for Java 8 in the RI and any feature requests or suggestions by the community resulting from that.
2.15 Please describe how the RI and TCK will de delivered, i.e. as part of a profile or platform edition, or stand-alone, or both. Include version information for the profile or platform in your answer.

Red Hat, Inc. will deliver a Reference Implementation (RI) and Technology Compatibility Kit (TCK) available both stand-alone and as part of Java EE 8.
2.16 Please state the rationale if previous versions are available stand-alone and you are now proposing in 2.13 to only deliver RI and TCK as part of a profile or platform edition (See sections 1.1.5 and 1.1.6 of the JCP 2 document).

N/A
2.17 Please provide a description of the business terms for the Specification, RI and TCK that will apply when this JSR is final.

The specification will be licensed using the standard specification license (see http://jcp.org/aboutJava/communityprocess/speclead/final-license.txt) or a more open license if times permit to develop one and fall into agreement with Oracle’s legal team.

The RI and TCK will be licensed via the ASL 2.0 license (see http://www.apache.org/licenses/LICENSE-2.0.html).
2.18 Please describe the communications channel you have established for the public to observe Expert Group deliberations, provide feedback, and view archives of all Expert Group communications.

The primary communications channel will be the beanvalidation-dev mailing list (see http://lists.jboss.org/pipermail/beanvalidation-dev/). It’s the place where experts will discuss, but it’s also open for non-members of the EG to post and comment.
2.19 What is the URL of the Issue Tracker that the public can read, and how does the public log issues in the Issue Tracker?

The issue tracker is located at https://hibernate.atlassian.net/projects/BVAL. After creating an account in this JIRA instance, it’s open for everyone to log issues.
2.20 Please provide the location of the publicly accessible document archive you have created for the Expert Group.

The website at http://beanvalidation.org/ is the hub for archiving all documents and other contents around Bean Validation. Proposals for individual issues will be available under the http://beanvalidation.org/proposals/ tree, e.g. http://beanvalidation.org/proposals/BVAL-508/. The archive of the Bean Validation mailing list can be found at http://lists.jboss.org/pipermail/beanvalidation-dev/.

Section 3: Contributions

3.1 Please list any existing documents, specifications, or implementations that describe the technology. Please include links to the documents if they are publicly available.

  • Bean Validation web site: http://beanvalidation.org/
  • Bean Validation specification: http://www.jcp.org/en/jsr/detail?id=349
  • Hibernate Validator (reference implementation): http://hibernate.org/validator
  • Description of proprietary Java 8 support in the RI: http://docs.jboss.org/hibernate/stable/validator/reference/en-US/html_single/#_java_8_support
    3.2 Explanation of how these items might be used as a starting point for the work.

Bean Validation as defined by JSR-349 will be the starting point for this work. The reference implementation already provides proprietary support for Java 8. Based on the experiences and community feedback with that implementation, work will commence.

Section 4: Additional Information

4.1 This section contains any additional information that the submitting Member wishes to include in the JSR.

The expert group will be formed once the specification is approved. All expert group discussions will occur on an open list as described above, and anyone is welcome to join in with the discussion, you simply need to subscribe to the list.

Contact Us
© 2020, Oracle Corporation and/or its affiliates. Terms of Use. Privacy Policy. Trademarks
Oracle Corporation

相关阅读

相关文章

相关问答