You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Constraint validators can be registered with the validation engine in the following ways (in increasing order of priority):
1801
+
1802
+
* Provided by the validation engine itself (see <<builtinconstraints,Built-in constraints>>)
1803
+
* [tck-testable]#Via the Java https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ServiceLoader.html[service loader] mechanism;
1804
+
for this the file _META-INF/services/jakarta.validation.ConstraintValidator_ must be provided#,
1805
+
with the fully-qualified name(s) of one or more constraint validator implementations as its contents.
1806
+
* [tck-testable]#Provided in the `validatedBy()` attribute of the `@jakarta.validation.Constraint` annotation#.
1807
+
* [tck-testable]#Through XML mapping# (see <<xml-mapping-constraintdeclarationinxml>>).
1808
+
1809
+
[tck-testable]#If multiple constraint validators for the exactly same constraint and target type are registered via one of the above methods,
1810
+
a `jakarta.validation.ConstraintDefinitionException` is thrown,#
1811
+
[tck-testable]#unless the constraint validator configuration source allows specifying that it overrides any previously defined constraint validators
1812
+
for the particular constraint (e.g. <<xml-mapping-constraintdeclarationinxml-classleveloverriding>>/<<xml-mapping-constraintdeclarationinxml-constructorleveloverriding>>/<<xml-mapping-constraintdeclarationinxml-fieldleveloverriding>>/<<xml-mapping-constraintdeclarationinxml-methodleveloverriding>>/<<xml-mapping-constraintdeclarationinxml-propertyleveloverriding>>).#
1795
1813
1796
-
==== ConstraintValidator resolution algorithm
1814
+
[NOTE]
1815
+
====
1816
+
{spec-name-bv} providers may have other means to register and/or override constraint validators.
A constraint is associated to one or more [classname]`ConstraintValidator` implementations. Each [classname]`ConstraintValidator<A, T>` accepts the type [classname]`T`. The [classname]`ConstraintValidator` executed depends on the type hosting the constraint. For a given constraint evaluation, a single [classname]`ConstraintValidator` is considered.
1799
1823
@@ -1909,7 +1933,7 @@ Exactly one value extractor must be identified when processing a container eleme
1909
1933
Value extractors can be registered with the validation engine in the following ways (in increasing order of priority):
1910
1934
1911
1935
* Provided by the validation engine itself (see <<valueextractordefinition-builtinvalueextractors>>)
1912
-
* [tck-testable]#Via the Java https://docs.oracle.com/javase/8/docs/api/java/util/ServiceLoader.html[service loader] mechanism; for this the file _META-INF/services/jakarta.validation.valueextraction.ValueExtractor_ must be provided#,
1936
+
* [tck-testable]#Via the Java https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/util/ServiceLoader.html[service loader] mechanism; for this the file _META-INF/services/jakarta.validation.valueextraction.ValueExtractor_ must be provided#,
1913
1937
with the fully-qualified name(s) of one or more extractor implementations as its contents.
1914
1938
It is undefined which value extractor will be selected if multiple extractors for the same type and type parameter are registered via the service loader mechanism.
1915
1939
* [tck-testable]#By specifying the fully-qualified class name of one or several extractors in `META-INF/validation.xml`# (see <<validationapi-bootstrapping-xmlconfiguration>>). Not more than one extractor for the same type and type parameter may be given.
0 commit comments