<html>
  <head>
    <meta content="text/html; charset=ISO-8859-1"
      http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    Yes, injecting dependency via constructor args into validator
    instances is not supported. Validator classes need to have a default
    constructor and are instantiated by the validation framework, not
    the DI framework. <br>
    Spring does not raise an exception since it is not responsible to
    instantiate the object but only to wire the field dependencies.<br>
    <br>
    Regards,<br>
    Seb<br>
    <br>
    On 22.10.2011 10:39, Emmanuel Bernard wrote:
    <blockquote
      cite="mid:4A39AD96-B823-4800-B76C-887BBD6F4A37@hibernate.org"
      type="cite">
      <div>Indeed that's a typo for ConstraintViolationFactory.&nbsp;</div>
      <div><br>
      </div>
      <div>In your approach, the object cannot use constructor
        injection, correct?</div>
      <div>What does Spring Framework do in this case, raise an
        exception?<br>
        <br>
        On 22 oct. 2011, at 01:33, Sebastian Thomschke &lt;<a
          moz-do-not-send="true"
          href="mailto:sebastian.thomschke@web.de">sebastian.thomschke@web.de</a>&gt;
        wrote:<br>
        <br>
      </div>
      <blockquote type="cite">
        <div>
          <meta content="text/html; charset=ISO-8859-1"
            http-equiv="Content-Type">
          Hi Emmanuel,<br>
          <br>
          the proposal talks about a ConstraintViolationFactory. I guess
          you meant ConstraintValidatorFactory?<br>
          <br>
          In OVal dependency injection works like this: OVal
          instantiates the validator (check) object itself and then
          passes it to an optional CheckInitializationListener which can
          wire required dependencies. So the DI system does not create
          the validator instances but configures the dependencies.<br>
          <br>
          For Spring DI in OVal you do:<br>
          &nbsp; ClassPathXmlApplicationContext ctx = new
          ClassPathXmlApplicationContext("SpringInjectorTest.xml",
          SpringInjectorTest.class);<br>
          &nbsp; AnnotationsConfigurer myConfigurer = new
          AnnotationsConfigurer();<br>
          &nbsp; myConfigurer.addCheckInitializationListener(new
          BeanInjectingCheckInitializationListener());<br>
          &nbsp; Validator v = new Validator(myConfigurer);<br>
          <br>
          Where the BeanInjectingCheckInitializationListener is
          implemented like:<br>
          <br>
          &nbsp; public class BeanInjectingCheckInitializationListener
          implements CheckInitializationListener {<br>
          &nbsp;&nbsp;&nbsp; public void onCheckInitialized(final Check newCheck) {<br>
          &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // wire the dependencies<br>
          &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; SpringInjector.get().inject(newCheck);<br>
          &nbsp;&nbsp; &nbsp;&nbsp; }<br>
          &nbsp; }<br>
          <br>
          For Bean Validation this could look like:<br>
          <pre><code>ValidatorFactory factory = Validation
  .byDefaultProvider()
  .configure()
  .addValidatiorInitializationListener(new SpringBeanInjectingValidatorInitializationListener()) 
  .buildValidatorFactory();

Regards,

Seb
</code></pre>
          <br>
          On 21.10.2011 23:55, Emmanuel Bernard wrote:
          <blockquote
            cite="mid:215E8EC6-3B81-48AC-8331-62D7DEEFC735@hibernate.org"
            type="cite">
            <pre wrap="">Hi team,
I've been thinking about BVAL-238 and came up with a first round of ideas and open questions.
It is available here <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://beanvalidation.org/proposals/BVAL-238/">http://beanvalidation.org/proposals/BVAL-238/</a>

Please give me your feedback. I think this issue can be closed quite quickly.

I've also created a proposals section on the website that will contain such work in progress proposals before inclusion in the spec proper. Check out <a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://beanvalidation.org/proposals">http://beanvalidation.org/proposals</a>

On a side note, for casual website editing, you can use GitHub's `Edit this file` button (see <a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://github.com/beanvalidation/beanvalidation.org/blob/master/proposals/BVAL-238.md">https://github.com/beanvalidation/beanvalidation.org/blob/master/proposals/BVAL-238.md</a> ). It's not quite a wiki but that's pretty close. One thing you cannot do is create a new file unfortunately. Anyone that have asked for write access should see this button.

Emmanuel
_______________________________________________
beanvalidation-dev mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a>
</pre>
          </blockquote>
          <br>
        </div>
      </blockquote>
      <blockquote type="cite">
        <div><span>_______________________________________________</span><br>
          <span>beanvalidation-dev mailing list</span><br>
          <span><a moz-do-not-send="true"
              href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a></span><br>
          <span><a moz-do-not-send="true"
              href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a></span><br>
        </div>
      </blockquote>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
beanvalidation-dev mailing list
<a class="moz-txt-link-abbreviated" href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a>
<a class="moz-txt-link-freetext" href="https://lists.jboss.org/mailman/listinfo/beanvalidation-dev">https://lists.jboss.org/mailman/listinfo/beanvalidation-dev</a>
</pre>
    </blockquote>
    <br>
  </body>
</html>