Details
-
New Feature
-
Status: Closed
-
Major
-
Resolution: Fixed
-
None
-
None
Description
it should be possible to provide/override constraint-validators via bean(s) provided by a bean-management facility/dependency injection provider e.g. to allow to inject services into constraint-validators.
the minimal version of a bv-constraint is:
@Constraint(validatedBy =
{ CustomConstraintValidator.class })
@Target(
)
@Retention(RUNTIME)
public @interface CustomConstraint
{
String message() default "default message";
Class<?>[] groups() default { };
Class<? extends Payload>[] payload() default { };
}
validatedBy is required as well. the mechanism should use the class name of the constraint-validator to get the bean name (in this case: the bean name is: customConstraintValidator)
if a bean with this name is available and it is a constraint validator, the found bean should be used instead of a plain instance of the found class.