<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Got it. Spring Framework does not really have an instantiateBean() destroyBean contract. Indeed if CDI turns out the same, we will need to follow your strategy. I'll circle back with Pete Muir from CDI to clarify this.<div><br><div><div>On 22 oct. 2011, at 19:17, Sebastian Thomschke wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type">
<div bgcolor="#FFFFFF" text="#000000">
In OVal the advantage is, that we can control when an object is
instantiated. If I would leave that to e.g. Spring and rely on
ApplicationContext.getBean(...) it might be that Spring reuses
objects and gives me the same instance twice if wrongly configured
(not as a prototype bean).<br>
<br>
Regards,<br>
Seb<br>
<br>
On 22.10.2011 10:46, Emmanuel Bernard wrote:
<blockquote cite="mid:714913FC-E770-41A8-A860-CFF92EA4F858@hibernate.org" type="cite">
<div>BTW, Sebastian, do you have a reason to still control the
object instantiation in OVal?</div>
<div><br>
</div>
<div>I wonder if there are any additional advantages besides the
ability to chain initialization listeners. <br>
<br>
On 22 oct. 2011, at 10:39, Emmanuel Bernard <<a moz-do-not-send="true" href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>>
wrote:<br>
<br>
</div>
<blockquote type="cite">
<div>
<div>Indeed that's a typo for ConstraintViolationFactory. </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 <<a moz-do-not-send="true" href="mailto:sebastian.thomschke@web.de">sebastian.thomschke@web.de</a>>
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>
ClassPathXmlApplicationContext ctx = new
ClassPathXmlApplicationContext("SpringInjectorTest.xml",
SpringInjectorTest.class);<br>
AnnotationsConfigurer myConfigurer = new
AnnotationsConfigurer();<br>
myConfigurer.addCheckInitializationListener(new
BeanInjectingCheckInitializationListener());<br>
Validator v = new Validator(myConfigurer);<br>
<br>
Where the BeanInjectingCheckInitializationListener is
implemented like:<br>
<br>
public class BeanInjectingCheckInitializationListener
implements CheckInitializationListener {<br>
public void onCheckInitialized(final Check newCheck) {<br>
// wire the dependencies<br>
SpringInjector.get().inject(newCheck);<br>
}<br>
}<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>
</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>
</div>
_______________________________________________<br>beanvalidation-dev mailing list<br><a href="mailto:beanvalidation-dev@lists.jboss.org">beanvalidation-dev@lists.jboss.org</a><br>https://lists.jboss.org/mailman/listinfo/beanvalidation-dev<br></blockquote></div><br></div></body></html>