blob: 2525cfe2d9d41637a293c10a6a234942ee6a78e1 [file] [view]
<!---
Licensed to the Apache Software Foundation (ASF) under one
or more contributor license agreements. See the NOTICE file
distributed with this work for additional information
regarding copyright ownership. The ASF licenses this file
to you under the Apache License, Version 2.0 (the
"License"); you may not use this file except in compliance
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing,
software distributed under the License is distributed on an
"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
KIND, either express or implied. See the License for the
specific language governing permissions and limitations
under the License.
-->
<div align="center">
<img src="https://bval.apache.org/resources/images/logo.png" width="300" />
</div>
<br>
![Maven Central](https://img.shields.io/maven-central/v/org.apache.bval/bval-jsr)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![Build Status ASF](https://github.com/apache/bval/workflows/BVal%20CI/badge.svg)](https://github.com/apache/bval/actions/workflows/bval-ci.yml)
Apache BVal - Apache's implementation of the Jakarta Validation specification for Jakarta EE and Java SE
## Branches
### master / 4.0.x
Jakarta Validation 4.0 implementation (Jakarta EE 12, WIP), requires Java 17+.
### 3.1.x
![3.1.x](https://img.shields.io/maven-central/v/org.apache.bval/bval-jsr?versionPrefix=3.1&color=cyan)
Jakarta Validation 3.1 implementation (Jakarta EE 11), requires Java 17+.
### 3.0.x
![3.0.x](https://img.shields.io/maven-central/v/org.apache.bval/bval-jsr?versionPrefix=3.0&color=cyan)
Jakarta Bean Validation 3.0 implementation (Jakarta EE 10), requires Java 11+.
### 2.x
![2.x](https://img.shields.io/maven-central/v/org.apache.bval/bval-jsr?versionPrefix=2.&color=cyan)
Bean Validation 2.0 (JSR-380) implementation (Java EE 8), requires Java 8+.
### 1.1.x
![1.1.x](https://img.shields.io/maven-central/v/org.apache.bval/bval-jsr?versionPrefix=1.1&color=cyan)
Bean Validation 1.1 (JSR-349) implementation (Java EE 7), requires Java 6+.
## Minimum Requirements (master)
- Java 17+
- Jakarta Validation 4.0 (Jakarta EE 12)
- TCK compliant
## Installation
```shell
mvn clean install
```
## Usage
### Dependency
```xml
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-jsr</artifactId>
<version>${bval.version}</version>
</dependency>
```
### Optional: extra constraints
```xml
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>bval-extras</artifactId>
<version>${bval.version}</version>
</dependency>
```
### Optional: OSGi bundle
```xml
<dependency>
<groupId>org.apache.bval</groupId>
<artifactId>org.apache.bval.bundle</artifactId>
<version>${bval.version}</version>
</dependency>
```
### Basic usage
```java
ValidatorFactory validatorFactory = Validation
.byProvider(ApacheValidationProvider.class)
.configure()
.buildValidatorFactory();
Validator validator = validatorFactory.getValidator();
Set<ConstraintViolation<MyBean>> violations = validator.validate(myBean);
```
## More Information
Please visit https://bval.apache.org for full documentation and release notes.
Issue tracker: https://issues.apache.org/jira/browse/BVAL