Announcement Announcement Module
No announcement yet.
Partial JSR303 Validation in Spring Webflow state Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Partial JSR303 Validation in Spring Webflow state

    I have an entity which has several fields with JSR303 annotated constraints. I want the user to set those fields in several steps. I thought view states with explicit binding properties would do the job.

    I enable JSR303 validation by setting a LocalValidatorFactoryBean as validator bean for <webflow:flow-builder-services … validator="flowValidator"/>. hibernate-validator-5 is in the class path.

    public class FlowConfiguration {
       @Bean LocalValidatorFactoryBean flowValidator() {
                return new LocalValidatorFactoryBean();
    This doesn't do the job as I need it. With an enabled validator the view state validates the complete entity, which fails as there are @NotNull constraints. Although the view-state has only a subset.

    HTML Code:
    <view-state id="insertUser" view="registration/insertUser" model="vendor">
                <binding property="email" required="true" />
                <binding property="name"  required="true" />
    It turns out that the best what I could do is remove each @NotNull (implicit and explicit) annotations from my entity. Is there no way to leave my entity contraint and have only those fields validated which are specified as explicit binding properties?

    By further reading I found out that I'm talking about JSR-303 groups. Is there any support for validating groups with Spring web flow?

    By further Reading I found that this feature comes in SWF 2.4:
    Last edited by malkusch; Jan 24th, 2013, 06:11 PM.