简体   繁体   English

春季批验证

[英]Spring Batch validation

Does Spring Batch framework provide its specific validation mechanism? Spring Batch框架是否提供其特定的验证机制?
I mean, how it's possible to specify validation bean? 我的意思是,如何指定验证bean?

Is spring Validator acceptable see example here ? spring Validator是否可以接受, 请参见示例

My validation is result of @NamedQuery - if query returned result, the validation is OK, else - false. 我的验证是@NamedQuery的结果-如果查询返回结果,则验证正确,否则-否。

看看spring-batch可用的ValidatingItemProcessor

I would suggest that you use a step to validate the data. 我建议您使用一个步骤来验证数据。

If the step does not return an element, the element is 'forgotten' and next one is treated. 如果该步骤未返回元素,则该元素被“遗忘”,并处理下一个元素。 If your query returns data, then make the step return the element. 如果查询返回数据,则使该步骤返回元素。 It will be treated by next step (classical behavior). 下一步将处理它(经典行为)。

You can even imagine creating a Validation Service (Spring service) and use a TaskletAdapter which will delegate the validation to your service. 您甚至可以想象创建一个Validation Service(Spring服务)并使用TaskletAdapter它将验证委托给您的服务。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM