Add scenario benchmarks comparing BVal and Hibernate Validator

ScenarioBenchmark runs each scenario against both providers, selected by a
JMH parameter, and checks the expected violation counts once per trial:
mixed valid/invalid beans, explicit groups, validateProperty/Value,
parameter and return value validation, cascading into large collections
and cycles, container element constraints, deep graphs, beans with many
built-in constraints (valid and fully invalid), composed and class-level
constraints, and EL message expressions.

Also run the JMH annotation processor explicitly, as JDK 23+ no longer
does so implicitly, and register Tomcat's ExpressionFactory ahead of the
bval-jsr test fixture that re-resolves its delegate on every call.

Both benchmark classes default to 2 forks of 3 warmup and 5 measurement
iterations of 1 s, so that a plain run takes minutes rather than hours.
4 files changed
tree: f0c8b75638fd7780b0081813a280b23dbf13a569
  1. .github/
  2. bval-bundle/
  3. bval-extras/
  4. bval-jsr/
  5. bval-perf/
  6. bval-tck/
  7. src/
  8. .asf.yaml
  9. .gitignore
  10. CHANGES.txt
  11. LICENSE
  12. NOTICE
  13. pom.xml
  14. README.md
  15. README.txt
  16. RELEASE-NOTES.adoc
README.md

Maven Central License Build Status ASF

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
Jakarta Validation 3.1 implementation (Jakarta EE 11), requires Java 17+.

3.0.x

3.0.x
Jakarta Bean Validation 3.0 implementation (Jakarta EE 10), requires Java 11+.

2.x

2.x
Bean Validation 2.0 (JSR-380) implementation (Java EE 8), requires Java 8+.

1.1.x

1.1.x
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

mvn clean install

Usage

Dependency

<dependency>
    <groupId>org.apache.bval</groupId>
    <artifactId>bval-jsr</artifactId>
    <version>${bval.version}</version>
</dependency>

Optional: extra constraints

<dependency>
    <groupId>org.apache.bval</groupId>
    <artifactId>bval-extras</artifactId>
    <version>${bval.version}</version>
</dependency>

Optional: OSGi bundle

<dependency>
    <groupId>org.apache.bval</groupId>
    <artifactId>org.apache.bval.bundle</artifactId>
    <version>${bval.version}</version>
</dependency>

Basic usage

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