【问题标题】:Running a specific spring batch job amongst several jobs contained withing a spring boot fat jar在 spring boot fat jar 中包含的多个作业中运行特定的 spring 批处理作业
【发布时间】:2015-08-24 05:30:52
【问题描述】:

我正在尝试从 spring boot fat jar 运行 spring 批处理作业,但在引用嵌套 jar 时遇到问题。

这是我使用的命令:

java -cp bignibou-batch-core/build/libs/bignibou-batch-core.jar:lib/spring-batch-core-3.0.3.RELEASE.jar org.springframework.batch.core.launch.support.CommandLineJobRunner com.bignibou.batch.configuration.BatchConfiguration mailingJob

注意我是如何使用冒号引用嵌套的 spring 批处理 jar 的。为什么这不起作用?

它说找不到主类:

Erreur : impossible de trouver ou charger la classe principale org.springframework.batch.core.launch.support.CommandLineJobRunner

【问题讨论】:

  • 检查“lib/spring-batch-core-3.0.3.RELEASE.jar”是否缺失。
  • 感谢它没有丢失...
  • 你为什么试图将spring批处理jar称为可执行jar?您应该只使用:java -jar bignibou-batch-core/build/libs/bignibou-batch-core.jar...
  • 感谢 Michael:我想使用命令行运行器的原因是我将在同一个 fat jar 中执行多个批处理作业。

标签: java jar spring-boot spring-batch


【解决方案1】:

我发现有一个不错的选择可以从一个胖罐子中选择一项工作(从多个工作中):

--spring.batch.job.names=jobOne,jobThree

即使jobTwo 也存在,也只有jobOnejobThree 会运行。

有关文档,请参阅 http://docs.spring.io/spring-boot/docs/current/reference/html/howto-batch-applications.html

就我而言,这解决了我的问题:

java -jar bignibou-batch-core/build/libs/bignibou-batch-core.jar --spring.batch.job.names=mailingJob

【讨论】:

  • 终于有一些简单的东西,客户可以轻松使用
猜你喜欢
  • 2014-06-20
  • 2015-07-30
  • 1970-01-01
  • 1970-01-01
  • 2019-11-14
  • 1970-01-01
  • 2020-08-29
  • 2017-07-06
  • 2021-01-15
相关资源
最近更新 更多