命令行方式下运行spring batch 程序
By:Roy.LiuLast updated:2013-12-07
批处理程序在很多情况下是在命令行下运行的,至于spring batch 做成的批处理程序一般都是做成jar包方式,当然,做成jar 包,最好采用 maven 插件来构建,曾经写过一篇文章,如何用maven plugin 做有spring 相关的jar 包,参考这里: 用maven 创建基于spring的可执行的jar. 一旦做成jar包之后,就可以用如下命令方式运行:
比如在运行前面一个例子的时候(先转成maven工程吧. 比较简单.),可以采用如下方式:
如果需要参数 jobParameters,可以增加在命令最后
CommandLineJobRunner jobPath <options> jobIdentifier (jobParameters) </options> |
比如在运行前面一个例子的时候(先转成maven工程吧. 比较简单.),可以采用如下方式:
java -cp "target/dependency-jars/*:target/your-project.jar" org.springframework.batch.core.launch.support.CommandLineJobRunner spring/batch/jobs/job-read-files.xml readJob |
如果需要参数 jobParameters,可以增加在命令最后
$ java -cp "target/dependency-jars/*:target/your-project.jar" org.springframework.batch.core.launch.support.CommandLineJobRunner spring/batch/jobs/job-read-files.xml readJob file.name=testing.cvs |
From:一号门
Previous:Spring batch Tasklet 例子(源码下载)
RELATED ARTICLES
- spring batch csv文件导入到mysql数据库
- Spring batch Tasklet 例子(源码下载)
- Spring batch 入门学习教程(附源码)
- Spring Batch : A job instance already exists and is complete for parameters={}
- Spring Batch metadata tables are not created automatically?
- Spring Batch Example – CSV File To MySQL Database
- Spring Batch unit test example
- NoSuchBeanDefinitionException : No qualifying bean of type JobLauncherTestUtils
- Spring Batch Example – XML File To MongoDB Database
- Spring Batch Example – XML File To CSV File
- jobParameters cannot be found on object of type BeanExpressionContext
- How to convert Date in BeanWrapperFieldSetMapper
- Run Spring batch job with CommandLineJobRunner
- Spring Batch MultiResourceItemReader example
- Spring Batch Tasklet example
- Spring Batch listeners example
- Spring Batch Example – MySQL Database To XML
- Spring Batch Partitioning example
- Spring Batch + Spring TaskScheduler example
- Spring Batch Hello World Example
COMMENTS