I&#39;m torn on this one, Gunnar makes a good argument as ever. Defined by the BV spec would get my vote though, I guess preferring consistency across projects rather than within them.<br><br>Rich.<br><br><br>On Wednesday, 16 January 2013, Michael Nascimento &lt;<a href="mailto:misterm@gmail.com">misterm@gmail.com</a>&gt; wrote:<br>
&gt; I think BV should fully specify the behaviour, i.e., it should be some<br>&gt; sort of flag supported by our spec, not the technology consuming it.<br>&gt;<br>&gt; Regards,<br>&gt; Michael<br>&gt;<br>&gt; On Wed, Jan 16, 2013 at 7:08 AM, Emmanuel Bernard<br>
&gt; &lt;<a href="mailto:emmanuel@hibernate.org">emmanuel@hibernate.org</a>&gt; wrote:<br>&gt;&gt; Trying to summarize here: should the mechanism used to choose which method<br>&gt;&gt; is to be validated (all, non_getter, off) be defined by the integration<br>
&gt;&gt; technology or should it be defined by the Bean Validation spec.<br>&gt;&gt;<br>&gt;&gt; I see Gunnar&#39;s argument and I am not sure where to stand. My arguments<br>&gt;&gt; against Gunnar&#39;s proposal are the following:<br>
&gt;&gt;<br>&gt;&gt; - the behavior would be different depending on the integration technology<br>&gt;&gt; used (Spring, CDI, JSR-303, possibly even managed beans - not sure of the<br>&gt;&gt; consequences for managed beans)<br>
&gt;&gt; - I find it easier for a user to have all the control tools at his disposal<br>&gt;&gt; from within the spec. In particular the global flag to set the default value<br>&gt;&gt; naturally fits in validation.xml which would not really be possible if the<br>
&gt;&gt; integration technology takes ownership of this.<br>&gt;&gt;<br>&gt;&gt; You know our mantra has always been consistency across the whole app<br>&gt;&gt; development. Like a famous ring,<br>&gt;&gt;<br>&gt;&gt; One Way to rule them all, One Way to constraint them,<br>
&gt;&gt; One Way to validate them all and in the EE spec bind them.<br>&gt;&gt;<br>&gt;&gt; On the other hands, inheritance rules for @ValidateOnCall across inherited<br>&gt;&gt; methods, super types and the potentially future package level is really hard<br>
&gt;&gt; to define. But I don&#39;t think the integration technologies define them in a<br>&gt;&gt; clear way either for our needs at least. In CDI, you can find the rules in<br>&gt;&gt; chapter 4. <a href="http://docs.jboss.org/cdi/spec/1.1-PRD/pdf/cdi-spec.pdf">http://docs.jboss.org/cdi/spec/1.1-PRD/pdf/cdi-spec.pdf</a>. It&#39;s<br>
&gt;&gt; very much &quot;chose whatever you want&quot; IMO.<br>&gt;&gt;<br>&gt;&gt; Please, express your feedback even if not strong on the matter, we need to<br>&gt;&gt; make a decision quickly. The deadline is approaching fast.<br>
&gt;&gt;<br>&gt;&gt; Emmanuel<br>&gt;&gt;<br>&gt;&gt; On 15 janv. 2013, at 19:56, Gunnar Morling &lt;<a href="mailto:gunnar@hibernate.org">gunnar@hibernate.org</a>&gt; wrote:<br>&gt;&gt;<br>&gt;&gt; Hi all,<br>&gt;&gt;<br>
&gt;&gt; As you know we&#39;re likely going to exclude getter methods from method<br>&gt;&gt; validation by default and provide means of configuring the exact behavior<br>&gt;&gt; (e.g. to have getters validated for individual types).<br>
&gt;&gt;<br>&gt;&gt; The question is now how this configuration should look like and where it<br>&gt;&gt; should be described. I think there is two separate components here:<br>&gt;&gt;<br>&gt;&gt; 1) BV which provides the logic/engine for performing method validation<br>
&gt;&gt; 2) Technologies integrating the method validation feature, e.g. CDI, Spring<br>&gt;&gt; etc. For CDI, the behavior of this integration is described in the BV spec<br>&gt;&gt; (section 10.2 [1]) as per the Java EE conventions. For e.g. Spring, the<br>
&gt;&gt; behavior would be described in the Spring documentation.<br>&gt;&gt;<br>&gt;&gt; Regarding the configuration of including/excluding getters, one option would<br>&gt;&gt; be to define a BV-specific mechanism for the configuration of (e.g. a global<br>
&gt;&gt; option in validation.xml and/or an annotation like @ValidateOnCall). This<br>&gt;&gt; mechanism would have to be queried by the technologies integrating with<br>&gt;&gt; method validation.<br>&gt;&gt;<br>&gt;&gt; Alternatively, whether to include/exclude getters could be part of the<br>
&gt;&gt; configuration of 2). For CDI, this might e.g. happen by adding an attribute<br>&gt;&gt; &quot;validateGetters()&quot; to the interceptor binding annotation triggering method<br>&gt;&gt; validation, while e.g. Spring users might define an appropriate point cut<br>
&gt;&gt; expression matching all those methods they want to validate. For CDI we<br>&gt;&gt; would again describe the exact means in section 10.2 of the BV spec.<br>&gt;&gt;<br>&gt;&gt; Personally I&#39;d favor the latter approach for the following reasons:<br>
&gt;&gt;<br>&gt;&gt; * The configuration of which methods to intercept is IMO a natural<br>&gt;&gt; responsibility of integrating technologies<br>&gt;&gt; * Integrating technologies already define mechanisms for handling things<br>
&gt;&gt; like inheritance of metadata (e.g. configuration given on super-types),<br>&gt;&gt; resolving conflicts of global vs. local metadata etc. It makes sense to<br>&gt;&gt; reuse these mechanisms instead of defining alternative rules in the BV spec.<br>
&gt;&gt;<br>&gt;&gt; On the downside, one would be limited to the means of configuration provided<br>&gt;&gt; by a particular integrating technology. E.g. I&#39;m not aware of a way of<br>&gt;&gt; global configuration options in CDI (we might try to get this changed,<br>
&gt;&gt; though). I still think this should be addressed in the integrating<br>&gt;&gt; technology instead of BV.<br>&gt;&gt;<br>&gt;&gt; An