I was prototyping the CDI integration for Hibernate Validator and got some questions (the prototype code can be found in my fork and is partly based on Seam Validation.

Injection of ValidatorFactory and Validator instances

If I understood correctly each BV provider needs to implement a CDI Extension. In the prototype case case ValidationExtension. The question is what to do when the extension tries to register the Validator(Factory) beans and discovers that they are already available. I can think of three strategies:

  • Skip registration of new beans maybe with a warning message
  • Fail
  • Go ahead and register your beans. Each provider should in this case also provide a qualifier in its integration code which allows users to qualify the BV beans in the case where more than one BV provider is available.

The latter is the approach taken in the prototype. I am wondering whether there is a general strategy for this? What do other integrating technologies do?

This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira