Thanks guys. Especially the already discussed topic really helped me the see points. I am glad that at least I have one working solution but maybe finalizing discussed topics would be great. We rely on more and more Bean Validation by utilizing extensive database connections. Alternatives to XML binding - personally believe that it is a little bid error prone - will be inevitable after the wide adaption of the bean validation among frameworks such as Spring, Guice etc. Definitely having a simpler way for seperating constraint annotation and constraint validation into the modules will be mandatory. Despite of a great summary for possible solutions by Emmanuel, It can be great to revisit this topic.<div>
<br></div><div>Thanks </div><div><br></div><div><span style="font-size:14px;font-family:Arial,sans-serif"> </span></div>
<div><br><div class="gmail_quote">On 27 May 2012 13:44, Gunnar Morling <span dir="ltr"><<a href="mailto:gunnar@hibernate.org" target="_blank">gunnar@hibernate.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi,<br>
<br>
If I understand you correctly, your question is related to the cyclic<br>
dependency between constraint annotations and constraint validators.<br>
<br>
As of BV 1.0 I don't see another way than using an XML constraint<br>
mapping as already suggested by Matt and Hardy.<br>
<br>
There was a discussion on the subject within the EG a while ago [1],<br>
but we didn't really come to a conclusion back then. One idea was to<br>
employ the service loader mechanism to contribute validator<br>
implementations [2]. I still think that's quite promising.<br>
<br>
--Gunnar<br>
<br>
[1] <a href="http://lists.jboss.org/pipermail/beanvalidation-dev/2011-October/000064.html" target="_blank">http://lists.jboss.org/pipermail/beanvalidation-dev/2011-October/000064.html</a><br>
[2] <a href="http://lists.jboss.org/pipermail/beanvalidation-dev/2011-October/000075.html" target="_blank">http://lists.jboss.org/pipermail/beanvalidation-dev/2011-October/000075.html</a><br>
<br>
<br>
<br>
2012/5/25 Cemo <<a href="mailto:cemalettin.koc@gmail.com" target="_blank">cemalettin.koc@gmail.com</a>>:<br>
<div><div>> Hi,<br>
><br>
> I am not sure is this already discussed or not but currently I believe that<br>
> validation spec is very strict about coupling.<br>
><br>
> For example at interface level validator is declared by Interface.<br>
><br>
> @Constraint(validatedBy = EmailValidator.class)<br>
> @Retention(RUNTIME)<br>
> public @interface Email<br>
><br>
><br>
> And for the part EmailValidation part, we are referring again our Email<br>
> Interface<br>
><br>
> public class EmailValidator implements ConstraintValidator<Email, String><br>
><br>
> What I think is this contract is little tight. And because of the strict<br>
> contract, splitting validation by its interface is not possible.<br>
><br>
> And let me to clarify my use case too.<br>
><br>
> I have splitted my domain, validation and web projects (Web1, Web2, Web3)<br>
> and using spring extensively.<br>
><br>
> Domain (Has no dependency)<br>
> Validation (Has dependency to validation spec and optionally Spring<br>
> Framework. For example, It can validate an uniqueEmail field by checking<br>
> database. )<br>
> Web's (Has dependency to validation and domain)<br>
><br>
> My domain needs dependency to validation for validating it but it means also<br>
> depending spring and all other stuffs regarding Database validations. What I<br>
> want to split Validation contract to interfaces and implementations.<br>
> Interfaces could be declared at domain and implementations reside at<br>
> validation module. Validation module has a dependency to domain perfectly.<br>
><br>
> I have checked builtin constraints implementations but it seems there is not<br>
> any extensible points for it.<br>
><br>
> What are your suggestions for this situation?<br>
><br>
> Thanks<br>
><br>
><br>
</div></div><div><div>> _______________________________________________<br>
> beanvalidation-dev mailing list<br>
> <a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
><br>
<br>
_______________________________________________<br>
beanvalidation-dev mailing list<br>
<a href="mailto:beanvalidation-dev@lists.jboss.org" target="_blank">beanvalidation-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a><br>
</div></div></blockquote></div><br></div>