Reading Specification for JSR-303:
Constraint validation implementation instance life cycle - undefined
The initialization method is called by the Bean validation provider before any use of the constraint implementation.
The isValid method is evaluated by the Bean Validation provider each time this value is validated. It returns false if the value is invalid; otherwise, true. isValid implementations must be thread safe.
I can’t figure it out. initialize is called before every call to isValid, and should isValid be thread safe? Does this mean that I cannot store anything at the class level during initialization to access it later from isValid? Specifically, I need an annotation instance that is passed in for initialization.
Can someone shed some light on him, please?
Arash source
share