繁体   English   中英

将Spring Batch框架集成到Spring MVC框架

[英]Integrating spring batch framework to spring MVC framework

我想将Spring Batch框架集成到Spring MVC框架中,但出现以下错误。

发布代码段以获取更多说明。

JobParametersBuilder jpBuilder = new JobParametersBuilder().addString("inputfilename", "cvs/input/fxe_dadsDevice.dat");
                 jpBuilder.addString("output.file.name", "files/output/"+System.currentTimeMillis()+"_test.txt");
                 jobLauncher.run(job, jpBuilder.toJobParameters());

XML片段:

<bean class="org.springframework.batch.core.scope.StepScope" />
   <bean id="dadsdeviceItemReader" class="org.springframework.batch.item.file.FlatFileItemReader" scope="step">

          <property name="resource" value=”#{jobParameters['input.file.name']}"/>
          <property name="lineMapper" ref="dadsdeviceLineMapper" />
          <property name="strict" value="false" />
   </bean>

错误:

FlatFileItemReader:253 - Input resource does not exist URL [file:#{jobParameters['input.file.name']}]

回答你的问题

1)请像这样使用

<bean id="inputFile" class="org.springframework.batch.core.resource.StepExecutionResourceProxy">
  <property name="filePattern" value="file://%file.name%"/>
</bean>
<bean id="dadsdeviceItemReader" class="org.springframework.batch.item.file.FlatFileItemReader">
<property name="resource" ref="inputFile" />
</bean>

暂无
暂无

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

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