Thanks to the work for HV-1497, done by @Marko Bekhta and @Guillaume Smet, we now have a HibernateConstraintValidator which provides us an initialize method that also takes a HibernateConstraintValidatorInitializationContext argument.
Which btw is great and I was waiting for something like this for years
Because, that addition allows us to easily pass a dynamic payload to each new instance of a HibernateConstraintValidator - which for us was a major pain so far to do. Right now we could only get a static payload from the annotation. But now we could pass a dynamic payload each time we call validator.validate(). E.g. in almost all applications we use HV we need to know the language or country of a user for the validation process - think of zip codes which differ for each country. With the current architecture of BV / HV this is basically impossible to achieve. That's why we used hacks like put the language / country (the "payload") into a ThreadLocal and retrieve the "payload" from that ThreadLocal inside the isValid method of a ConstraintValidator.
That's why I propose following addition the Hibernate Validator:
Inside a HibernateConstraintValidator we can retrieve that payload like this:
This withDynamicConstraintValidatorInitializationPayload / getDynamicPayload approach is the same we already use to pass a Dynamic payload as part of ConstraintViolation: