for web application, you can assign different validation context tokens to different URLS:
HTML Code:
<beanid="validationContextInterceptor"class="..ValidationContextHandlerInterceptor">
<propertyname="validationContextUrlMappings">
<value>
/user/*=ctx1,ctx2
/admin/*=ctx3
</value>
</property>
</bean>
now, you can assign the 3 different tokens to the validation rules:
HTML Code:
@NotNull(contexts="ctx1,ctx2")
privateStringbla;
or
HTML Code:
<propertyname="bla">
<not-nullcontexts="ctx1,ctx2"/>
</property>
Now, when the rules will be executed under the context of the "/usr/*" url but not under the "/admin/*" url.
hope it helps
Uri