Markus Malkusch
Markus Malkusch

Reputation: 7868

Partial JSR303 groups 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.

@Configuration
@ImportResource("classpath:/flow.xml")
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.

<view-state id="insertUser" view="registration/insertUser" model="vendor">
        <binder>
            <binding property="email" required="true" />
            <binding property="name"  required="true" />
        </binder>
  …
</view-state>

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?

Upvotes: 1

Views: 797

Answers (1)

Markus Malkusch
Markus Malkusch

Reputation: 7868

SWF-1453 says it comes in SWF 2.4.0 and it's already available in the latest SNAPSHOT.

Upvotes: 2

Related Questions