【问题标题】:Partial JSR303 groups validation in Spring Webflow stateSpring Webflow 状态下的部分 JSR303 分组验证
【发布时间】:2013-01-24 00:04:41
【问题描述】:

我有一个实体,它有几个带有 JSR303 注释约束的字段。我希望用户分几个步骤设置这些字段。我认为具有显式绑定属性的视图状态可以完成这项工作。

我通过将 LocalValidatorFactoryBean 设置为 <webflow:flow-builder-services … validator="flowValidator"/> 的验证器 bean 来启用 JSR303 验证。 hibernate-validator-5 在类路径中。

@Configuration
@ImportResource("classpath:/flow.xml")
public class FlowConfiguration {
   @Bean LocalValidatorFactoryBean flowValidator() {
            return new LocalValidatorFactoryBean();
    }
}

这并不能满足我的需要。使用启用的验证器,视图状态会验证完整的实体,但由于存在 @NotNull 约束而失败。虽然视图状态只有一个子集。

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

通过进一步阅读,我发现我说的是 JSR-303 组。是否支持使用 Spring web flow 验证组?

【问题讨论】:

    标签: spring-mvc spring-webflow bean-validation hibernate-validator


    【解决方案1】:

    SWF-1453 表示它包含在 SWF 2.4.0 中,并且已经在最新的 SNAPSHOT 中可用。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-01-18
      • 1970-01-01
      • 2017-09-25
      • 1970-01-01
      • 1970-01-01
      • 2015-01-03
      • 1970-01-01
      • 2011-09-28
      相关资源
      最近更新 更多