Uploaded image for project: 'MyFaces Extensions Validator'
  1. MyFaces Extensions Validator
  2. EXTVAL-70

dependency injection for jsr 303 constraint-validators

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • New Feature
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.2.3, 2.0.3, 1.1.3
    • Bean Validation
    • 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(

      { METHOD, FIELD, ANNOTATION_TYPE /*...*/}

      )
      @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.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            gpetracek Gerhard Petracek
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment