dependecy injection for jsr 303 constraint-validators
-----------------------------------------------------
Key: EXTVAL-70
URL: https://issues.apache.org/jira/browse/EXTVAL-70
Project: MyFaces Extensions Validator
Issue Type: New Feature
Components: Bean Validation
Affects Versions: 1.2.3-SNAPSHOT, 2.0.3-SNAPSHOT, 1.1.3-SNAPSHOT
Reporter: Gerhard Petracek
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 = { CustomValidator.class })
@Target({ METHOD, FIELD, ANNOTATION_TYPE /*...*/})
@Retention(RUNTIME)
public @interface CustomNotEmpty
{
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:
customValidator)
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.
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.