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?
Method validation
Here are some questions regarding method validation. For this case the prototype defines an interceptor - ValidationInterceptor.
AFAIU interceptors in CDI require a interceptor binding (aka annotation) which then must be placed on the class/method on which to apply interception. On the bv-dev mailing we have been discussing that we actually don't need a @MethodValidated annotation (see also BVAL-305) and that it should be enabled by default for all entities. The question is would something like this be possible with CDI?
What's about constructor validation. Will there be a way in CDI 1.1 to do this? It is not possible right now, right?
On the bv-dev mailing list we have been discussing when the BV interceptor should be triggered in relation to other interceptors. I am wondering how an BV and its integration code can influence the interceptor order of an app? Is it not really the user application which defines in its beans.xml which interceptors are enabled in which order? Emmanuel mentioned that there might be some changes related to this in CDI 1.1. Is this correct?
Feedback welcome
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
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:
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?
Method validation
Here are some questions regarding method validation. For this case the prototype defines an interceptor - ValidationInterceptor.
Feedback welcome