Skip to content

Commit

Permalink
Merge pull request #18935 from gsmet/hv-scope
Browse files Browse the repository at this point in the history
Clarify scope for ConstraintValidators
  • Loading branch information
gsmet authored Jul 22, 2021
2 parents 3807403 + 0efb8fe commit cf73c98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion docs/src/main/asciidoc/validation.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,11 @@ You don't have to wire anything.
====
Obviously, for each listed type, you can declare only one bean.
These beans should be declared as `@ApplicationScoped`.
Most of the time, these beans should be declared as `@ApplicationScoped`.
However, in the case of ``ConstraintValidator``s that are dependent of attributes of the constraint annotation
(typically when implementing the `initialize(A constraintAnnotation)` method),
use the `@Dependent` scope to make sure each annotation context has a separate instance of the `ConstraintValidator` bean.
====

==== Constraint validators as beans
Expand Down

0 comments on commit cf73c98

Please sign in to comment.