![](/img/trans.png)
[英]Spring Batch CommandLineJobRunner can't find .xml configuration file
[英]how to launch Spring Batch Job using CommandLineJobRunner having Java configuration
我在基于 Java 的配置文件中定义了批处理作业。 我已经看到CommandLineJobRunner
可用于启动作业,但作业定义应在 .xml 中定义。 我想使用CommandLineJobRunner
来运行我在基于 Java 的配置中定义的作业。
根据此处的文档: https ://docs.spring.io/spring-batch/trunk/reference/html/configureJob.html#commandLineJobRunner,没有这样做的详细信息。
我们甚至可以这样做吗? 还有什么其他选择?
CommandLineJobRunner
的第一个参数可以是:
从 Spring Batch v4 开始,每个文档页面顶部都有一个切换开关,允许您在 Java 或 Xml 配置中显示示例。 例如,当切换设置为“Java”时,此处的文档部分: https ://docs.spring.io/spring-batch/4.0.x/reference/html/job.html#runningJobsFromCommandLine 显示了如何使用带有 Java 配置类的CommandLineJobRunner
:
$>java -cp your/class/path org.springframework.batch.core.launch.support.CommandLineJobRunner io.spring.EndOfDayJobConfiguration endOfDay schedule.date(date)=2007/05/05
io.spring.EndOfDayJobConfiguration
是包含endOfDay
作业定义的完全限定类名。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.